1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.app.sdksandbox.sdkprovider; 18 19 import android.annotation.FlaggedApi; 20 21 import com.android.sdksandbox.flags.Flags; 22 23 import java.util.concurrent.Executor; 24 25 /** 26 * Used to notify the SDK about changes in the client's {@link 27 * android.app.ActivityManager.RunningAppProcessInfo#importance}. 28 * 29 * <p>When an SDK wants to get notified about changes in client's importance, it should register an 30 * implementation of this interface by calling {@link 31 * SdkSandboxController#registerSdkSandboxClientImportanceListener(Executor, 32 * SdkSandboxClientImportanceListener)}. 33 */ 34 @FlaggedApi(Flags.FLAG_SANDBOX_CLIENT_IMPORTANCE_LISTENER) 35 public interface SdkSandboxClientImportanceListener { 36 /** 37 * Invoked every time the client transitions from a value <= {@link 38 * android.app.ActivityManager.RunningAppProcessInfo#IMPORTANCE_FOREGROUND} to a higher value or 39 * vice versa 40 * 41 * @param isForeground true when the client transitions to {@link 42 * android.app.ActivityManager.RunningAppProcessInfo#IMPORTANCE_FOREGROUND} or lower and 43 * false when it is the other way round. 44 */ 45 @FlaggedApi(Flags.FLAG_SANDBOX_CLIENT_IMPORTANCE_LISTENER) onForegroundImportanceChanged(boolean isForeground)46 void onForegroundImportanceChanged(boolean isForeground); 47 } 48