Loading core/java/android/app/ActivityManagerInternal.java +9 −0 Original line number Diff line number Diff line Loading @@ -224,4 +224,13 @@ public abstract class ActivityManagerInternal { * Called when the trusted state of Keyguard has changed. */ public abstract void notifyKeyguardTrustedChanged(); /** * Sets if the given pid has an overlay UI or not. * * @param pid The pid we are setting overlay UI for. * @param hasOverlayUi True if the process has overlay UI. * @see android.view.WindowManager.LayoutParams#TYPE_APPLICATION_OVERLAY */ public abstract void setHasOverlayUi(int pid, boolean hasOverlayUi); } core/java/android/view/WindowManager.java +4 −1 Original line number Diff line number Diff line Loading @@ -729,7 +729,10 @@ public interface WindowManager extends ViewManager { * <p> * Requires {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW} permission. * <p> * In mult-iuser systems shows only on the owning user's screen. * The system will adjust the importance of processes with this window type to reduce the * chance of the low-memory-killer killing them. * <p> * In multi-user systems shows only on the owning user's screen. */ public static final int TYPE_APPLICATION_OVERLAY = FIRST_SYSTEM_WINDOW + 38; Loading core/java/android/view/WindowManagerPolicy.java +3 −3 Original line number Diff line number Diff line Loading @@ -786,13 +786,13 @@ public interface WindowManagerPolicy { case TYPE_PRIORITY_PHONE: // SIM errors and unlock. Not sure if this really should be in a high layer. return 9; case TYPE_DREAM: // used for Dreams (screensavers with TYPE_DREAM windows) return 10; case TYPE_SYSTEM_ALERT: // like the ANR / app crashed dialogs return canAddInternalSystemWindow ? 11 : 10; case TYPE_APPLICATION_OVERLAY: return 12; case TYPE_DREAM: // used for Dreams (screensavers with TYPE_DREAM windows) return 13; case TYPE_INPUT_METHOD: // on-screen keyboards and other such input method user interfaces go here. Loading services/core/java/com/android/server/am/ActivityManagerService.java +34 −0 Original line number Diff line number Diff line Loading @@ -20142,6 +20142,13 @@ public class ActivityManagerService extends IActivityManager.Stub app.adjType = "force-fg"; app.adjSource = app.forcingToForeground; schedGroup = ProcessList.SCHED_GROUP_DEFAULT; } else if (app.hasOverlayUi) { // The process is display an overlay UI. adj = ProcessList.PERCEPTIBLE_APP_ADJ; procState = ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND; app.cached = false; app.adjType = "has-overlay-ui"; schedGroup = ProcessList.SCHED_GROUP_DEFAULT; } } Loading Loading @@ -22861,6 +22868,33 @@ public class ActivityManagerService extends IActivityManager.Stub } } } /** * Sets if the given pid has an overlay UI or not. * * @param pid The pid we are setting overlay UI for. * @param hasOverlayUi True if the process has overlay UI. * @see android.view.WindowManager.LayoutParams#TYPE_APPLICATION_OVERLAY */ @Override public void setHasOverlayUi(int pid, boolean hasOverlayUi) { synchronized (ActivityManagerService.this) { final ProcessRecord pr; synchronized (mPidsSelfLocked) { pr = mPidsSelfLocked.get(pid); if (pr == null) { Slog.w(TAG, "setHasOverlayUi called on unknown pid: " + pid); return; } } if (pr.hasOverlayUi == hasOverlayUi) { return; } pr.hasOverlayUi = hasOverlayUi; //Slog.i(TAG, "Setting hasOverlayUi=" + pr.hasOverlayUi + " for pid=" + pid); updateOomAdjLocked(pr); } } } private final class SleepTokenImpl extends SleepToken { services/core/java/com/android/server/am/ProcessRecord.java +15 −6 Original line number Diff line number Diff line Loading @@ -31,14 +31,11 @@ import com.android.internal.os.BatteryStatsImpl; import android.app.ActivityManager; import android.app.Dialog; import android.app.IApplicationThread; import android.app.IInstrumentationWatcher; import android.app.IUiAutomationConnection; import android.content.ComponentName; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.res.CompatibilityInfo; import android.os.Binder; import android.os.Bundle; import android.os.IBinder; import android.os.Process; import android.os.RemoteException; Loading @@ -46,7 +43,6 @@ import android.os.SystemClock; import android.os.Trace; import android.os.UserHandle; import android.util.ArrayMap; import android.util.PrintWriterPrinter; import android.util.TimeUtils; import java.io.PrintWriter; Loading Loading @@ -116,8 +112,18 @@ final class ProcessRecord { boolean repForegroundActivities; // Last reported foreground activities. boolean systemNoUi; // This is a system process, but not currently showing UI. boolean hasShownUi; // Has UI been shown in this process since it was started? boolean hasTopUi; // Is this process currently showing "top-level" UI that is not an // activity? boolean hasTopUi; // Is this process currently showing a non-activity UI that the user // is interacting with? E.g. The status bar when it is expanded, but // not when it is minimized. When true the // process will be set to use the ProcessList#SCHED_GROUP_TOP_APP // scheduling group to boost performance. boolean hasOverlayUi; // Is the process currently showing a non-activity UI that // overlays on-top of activity UIs on screen. E.g. display a window // of type // android.view.WindowManager.LayoutParams#TYPE_APPLICATION_OVERLAY // When true the process will oom adj score will be set to // ProcessList#PERCEPTIBLE_APP_ADJ at minimum to reduce the chance // of the process getting killed. boolean pendingUiClean; // Want to clean up resources from showing UI? boolean hasAboveClient; // Bound using BIND_ABOVE_CLIENT, so want to be lower boolean treatLikeActivity; // Bound using BIND_TREAT_LIKE_ACTIVITY Loading Loading @@ -425,6 +431,9 @@ final class ProcessRecord { if (hasTopUi) { pw.print(prefix); pw.print("hasTopUi="); pw.print(hasTopUi); } if (hasOverlayUi) { pw.print(prefix); pw.print("hasOverlayUi="); pw.print(hasOverlayUi); } } ProcessRecord(BatteryStatsImpl _batteryStats, ApplicationInfo _info, Loading Loading
core/java/android/app/ActivityManagerInternal.java +9 −0 Original line number Diff line number Diff line Loading @@ -224,4 +224,13 @@ public abstract class ActivityManagerInternal { * Called when the trusted state of Keyguard has changed. */ public abstract void notifyKeyguardTrustedChanged(); /** * Sets if the given pid has an overlay UI or not. * * @param pid The pid we are setting overlay UI for. * @param hasOverlayUi True if the process has overlay UI. * @see android.view.WindowManager.LayoutParams#TYPE_APPLICATION_OVERLAY */ public abstract void setHasOverlayUi(int pid, boolean hasOverlayUi); }
core/java/android/view/WindowManager.java +4 −1 Original line number Diff line number Diff line Loading @@ -729,7 +729,10 @@ public interface WindowManager extends ViewManager { * <p> * Requires {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW} permission. * <p> * In mult-iuser systems shows only on the owning user's screen. * The system will adjust the importance of processes with this window type to reduce the * chance of the low-memory-killer killing them. * <p> * In multi-user systems shows only on the owning user's screen. */ public static final int TYPE_APPLICATION_OVERLAY = FIRST_SYSTEM_WINDOW + 38; Loading
core/java/android/view/WindowManagerPolicy.java +3 −3 Original line number Diff line number Diff line Loading @@ -786,13 +786,13 @@ public interface WindowManagerPolicy { case TYPE_PRIORITY_PHONE: // SIM errors and unlock. Not sure if this really should be in a high layer. return 9; case TYPE_DREAM: // used for Dreams (screensavers with TYPE_DREAM windows) return 10; case TYPE_SYSTEM_ALERT: // like the ANR / app crashed dialogs return canAddInternalSystemWindow ? 11 : 10; case TYPE_APPLICATION_OVERLAY: return 12; case TYPE_DREAM: // used for Dreams (screensavers with TYPE_DREAM windows) return 13; case TYPE_INPUT_METHOD: // on-screen keyboards and other such input method user interfaces go here. Loading
services/core/java/com/android/server/am/ActivityManagerService.java +34 −0 Original line number Diff line number Diff line Loading @@ -20142,6 +20142,13 @@ public class ActivityManagerService extends IActivityManager.Stub app.adjType = "force-fg"; app.adjSource = app.forcingToForeground; schedGroup = ProcessList.SCHED_GROUP_DEFAULT; } else if (app.hasOverlayUi) { // The process is display an overlay UI. adj = ProcessList.PERCEPTIBLE_APP_ADJ; procState = ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND; app.cached = false; app.adjType = "has-overlay-ui"; schedGroup = ProcessList.SCHED_GROUP_DEFAULT; } } Loading Loading @@ -22861,6 +22868,33 @@ public class ActivityManagerService extends IActivityManager.Stub } } } /** * Sets if the given pid has an overlay UI or not. * * @param pid The pid we are setting overlay UI for. * @param hasOverlayUi True if the process has overlay UI. * @see android.view.WindowManager.LayoutParams#TYPE_APPLICATION_OVERLAY */ @Override public void setHasOverlayUi(int pid, boolean hasOverlayUi) { synchronized (ActivityManagerService.this) { final ProcessRecord pr; synchronized (mPidsSelfLocked) { pr = mPidsSelfLocked.get(pid); if (pr == null) { Slog.w(TAG, "setHasOverlayUi called on unknown pid: " + pid); return; } } if (pr.hasOverlayUi == hasOverlayUi) { return; } pr.hasOverlayUi = hasOverlayUi; //Slog.i(TAG, "Setting hasOverlayUi=" + pr.hasOverlayUi + " for pid=" + pid); updateOomAdjLocked(pr); } } } private final class SleepTokenImpl extends SleepToken {
services/core/java/com/android/server/am/ProcessRecord.java +15 −6 Original line number Diff line number Diff line Loading @@ -31,14 +31,11 @@ import com.android.internal.os.BatteryStatsImpl; import android.app.ActivityManager; import android.app.Dialog; import android.app.IApplicationThread; import android.app.IInstrumentationWatcher; import android.app.IUiAutomationConnection; import android.content.ComponentName; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.res.CompatibilityInfo; import android.os.Binder; import android.os.Bundle; import android.os.IBinder; import android.os.Process; import android.os.RemoteException; Loading @@ -46,7 +43,6 @@ import android.os.SystemClock; import android.os.Trace; import android.os.UserHandle; import android.util.ArrayMap; import android.util.PrintWriterPrinter; import android.util.TimeUtils; import java.io.PrintWriter; Loading Loading @@ -116,8 +112,18 @@ final class ProcessRecord { boolean repForegroundActivities; // Last reported foreground activities. boolean systemNoUi; // This is a system process, but not currently showing UI. boolean hasShownUi; // Has UI been shown in this process since it was started? boolean hasTopUi; // Is this process currently showing "top-level" UI that is not an // activity? boolean hasTopUi; // Is this process currently showing a non-activity UI that the user // is interacting with? E.g. The status bar when it is expanded, but // not when it is minimized. When true the // process will be set to use the ProcessList#SCHED_GROUP_TOP_APP // scheduling group to boost performance. boolean hasOverlayUi; // Is the process currently showing a non-activity UI that // overlays on-top of activity UIs on screen. E.g. display a window // of type // android.view.WindowManager.LayoutParams#TYPE_APPLICATION_OVERLAY // When true the process will oom adj score will be set to // ProcessList#PERCEPTIBLE_APP_ADJ at minimum to reduce the chance // of the process getting killed. boolean pendingUiClean; // Want to clean up resources from showing UI? boolean hasAboveClient; // Bound using BIND_ABOVE_CLIENT, so want to be lower boolean treatLikeActivity; // Bound using BIND_TREAT_LIKE_ACTIVITY Loading Loading @@ -425,6 +431,9 @@ final class ProcessRecord { if (hasTopUi) { pw.print(prefix); pw.print("hasTopUi="); pw.print(hasTopUi); } if (hasOverlayUi) { pw.print(prefix); pw.print("hasOverlayUi="); pw.print(hasOverlayUi); } } ProcessRecord(BatteryStatsImpl _batteryStats, ApplicationInfo _info, Loading