Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69810483 authored by Todd Kennedy's avatar Todd Kennedy
Browse files

Add getPackageImportance() system API

Callers must have the permission GET_PACKAGE_IMPORTANCE

Bug: 20642684
Change-Id: I6f3ef2ec810c884e0dee239e5909bcb314957302
parent 77b09382
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ package android {
    field public static final java.lang.String FORCE_STOP_PACKAGES = "android.permission.FORCE_STOP_PACKAGES";
    field public static final java.lang.String GET_ACCOUNTS = "android.permission.GET_ACCOUNTS";
    field public static final java.lang.String GET_APP_OPS_STATS = "android.permission.GET_APP_OPS_STATS";
    field public static final java.lang.String GET_PACKAGE_IMPORTANCE = "android.permission.GET_PACKAGE_IMPORTANCE";
    field public static final java.lang.String GET_PACKAGE_SIZE = "android.permission.GET_PACKAGE_SIZE";
    field public static final deprecated java.lang.String GET_TASKS = "android.permission.GET_TASKS";
    field public static final java.lang.String GET_TOP_ACTIVITY_INFO = "android.permission.GET_TOP_ACTIVITY_INFO";
+5 −0
Original line number Diff line number Diff line
@@ -1342,6 +1342,11 @@
        android:description="@string/permdesc_killBackgroundProcesses"
        android:protectionLevel="normal" />

    <!-- @SystemApi @hide Allows an application to retrieve a package's importance.
         This permission is not available to third party applications. -->
    <permission android:name="android.permission.GET_PACKAGE_IMPORTANCE"
        android:protectionLevel="signature|system" />

    <!-- ================================== -->
    <!-- Permissions affecting the display of other applications  -->
    <!-- ================================== -->
+2 −0
Original line number Diff line number Diff line
@@ -3589,6 +3589,8 @@ public final class ActivityManagerService extends ActivityManagerNative
    @Override
    public int getPackageProcessState(String packageName) {
        enforceCallingPermission(android.Manifest.permission.GET_PACKAGE_IMPORTANCE,
                "getPackageProcessState");
        int procState = ActivityManager.PROCESS_STATE_NONEXISTENT;
        synchronized (this) {
            for (int i=mLruProcesses.size()-1; i>=0; i--) {