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

Commit 20ded1f7 authored by kholoud mohamed's avatar kholoud mohamed
Browse files

Add INTERACT_ACROSS_PROFILES appop

Also, removes the 'privileged' protection level from the INTERACT_ACROSS_PROFILES permission and replaces it with 'appop'. 'Wellbeing' is also added temporarily, which will also be removed in this release.

This is part of a change to enable users to consent to cross profile app communications

BUG: 136249261
BUG: 144577776
BUG: 141690885
Test: atest AppOpsTest
Test: atest PermissionPolicyTest

Change-Id: I910daf7605f83946af171f38db002b920079f30b
parent d301ecf5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ package android {
    field public static final String INSTALL_PACKAGES = "android.permission.INSTALL_PACKAGES";
    field public static final String INSTALL_SHORTCUT = "com.android.launcher.permission.INSTALL_SHORTCUT";
    field public static final String INSTANT_APP_FOREGROUND_SERVICE = "android.permission.INSTANT_APP_FOREGROUND_SERVICE";
    field public static final String INTERACT_ACROSS_PROFILES = "android.permission.INTERACT_ACROSS_PROFILES";
    field public static final String INTERNET = "android.permission.INTERNET";
    field public static final String KILL_BACKGROUND_PROCESSES = "android.permission.KILL_BACKGROUND_PROCESSES";
    field public static final String LOCATION_HARDWARE = "android.permission.LOCATION_HARDWARE";
+1 −1
Original line number Diff line number Diff line
@@ -90,7 +90,6 @@ package android {
    field public static final String INSTALL_PACKAGE_UPDATES = "android.permission.INSTALL_PACKAGE_UPDATES";
    field public static final String INSTALL_SELF_UPDATES = "android.permission.INSTALL_SELF_UPDATES";
    field public static final String INTENT_FILTER_VERIFICATION_AGENT = "android.permission.INTENT_FILTER_VERIFICATION_AGENT";
    field public static final String INTERACT_ACROSS_PROFILES = "android.permission.INTERACT_ACROSS_PROFILES";
    field public static final String INTERACT_ACROSS_USERS = "android.permission.INTERACT_ACROSS_USERS";
    field public static final String INTERACT_ACROSS_USERS_FULL = "android.permission.INTERACT_ACROSS_USERS_FULL";
    field public static final String INTERNAL_SYSTEM_WINDOW = "android.permission.INTERNAL_SYSTEM_WINDOW";
@@ -363,6 +362,7 @@ package android.app {
    field public static final String OPSTR_GET_ACCOUNTS = "android:get_accounts";
    field public static final String OPSTR_GPS = "android:gps";
    field public static final String OPSTR_INSTANT_APP_START_FOREGROUND = "android:instant_app_start_foreground";
    field public static final String OPSTR_INTERACT_ACROSS_PROFILES = "android:interact_across_profiles";
    field public static final String OPSTR_LEGACY_STORAGE = "android:legacy_storage";
    field public static final String OPSTR_MANAGE_EXTERNAL_STORAGE = "android:manage_external_storage";
    field public static final String OPSTR_MANAGE_IPSEC_TUNNELS = "android:manage_ipsec_tunnels";
+17 −2
Original line number Diff line number Diff line
@@ -850,10 +850,12 @@ public class AppOpsManager {
    public static final int OP_QUERY_ALL_PACKAGES = 91;
    /** @hide Access all external storage */
    public static final int OP_MANAGE_EXTERNAL_STORAGE = 92;
    /** @hide Communicate cross-profile within the same profile group. */
    public static final int OP_INTERACT_ACROSS_PROFILES = 93;

    /** @hide */
    @UnsupportedAppUsage
    public static final int _NUM_OP = 93;
    public static final int _NUM_OP = 94;

    /** Access to coarse location information. */
    public static final String OPSTR_COARSE_LOCATION = "android:coarse_location";
@@ -1144,6 +1146,10 @@ public class AppOpsManager {
    public static final String OPSTR_MANAGE_EXTERNAL_STORAGE =
            "android:manage_external_storage";

    /** @hide Communicate cross-profile within the same profile group. */
    @SystemApi
    public static final String OPSTR_INTERACT_ACROSS_PROFILES = "android:interact_across_profiles";


    /** {@link #sAppOpsToNote} not initialized yet for this op */
    private static final byte SHOULD_COLLECT_NOTE_OP_NOT_INITIALIZED = 0;
@@ -1221,6 +1227,7 @@ public class AppOpsManager {
            OP_MANAGE_IPSEC_TUNNELS,
            OP_INSTANT_APP_START_FOREGROUND,
            OP_MANAGE_EXTERNAL_STORAGE,
            OP_INTERACT_ACROSS_PROFILES
    };

    /**
@@ -1325,6 +1332,7 @@ public class AppOpsManager {
            OP_ACCESS_MEDIA_LOCATION,           // ACCESS_MEDIA_LOCATION
            OP_QUERY_ALL_PACKAGES,              // QUERY_ALL_PACKAGES
            OP_MANAGE_EXTERNAL_STORAGE,         // MANAGE_EXTERNAL_STORAGE
            OP_INTERACT_ACROSS_PROFILES,        //INTERACT_ACROSS_PROFILES
    };

    /**
@@ -1424,6 +1432,7 @@ public class AppOpsManager {
            OPSTR_ACCESS_MEDIA_LOCATION,
            OPSTR_QUERY_ALL_PACKAGES,
            OPSTR_MANAGE_EXTERNAL_STORAGE,
            OPSTR_INTERACT_ACROSS_PROFILES,
    };

    /**
@@ -1523,7 +1532,8 @@ public class AppOpsManager {
            "READ_DEVICE_IDENTIFIERS",
            "ACCESS_MEDIA_LOCATION",
            "QUERY_ALL_PACKAGES",
            "MANAGE_EXTERNAL_STORAGE"
            "MANAGE_EXTERNAL_STORAGE",
            "INTERACT_ACROSS_PROFILES"
    };

    /**
@@ -1625,6 +1635,7 @@ public class AppOpsManager {
            Manifest.permission.ACCESS_MEDIA_LOCATION,
            null, // no permission for OP_QUERY_ALL_PACKAGES
            Manifest.permission.MANAGE_EXTERNAL_STORAGE,
            android.Manifest.permission.INTERACT_ACROSS_PROFILES,
    };

    /**
@@ -1726,6 +1737,7 @@ public class AppOpsManager {
            null, // ACCESS_MEDIA_LOCATION
            null, // QUERY_ALL_PACKAGES
            null, // MANAGE_EXTERNAL_STORAGE
            null, // INTERACT_ACROSS_PROFILES
    };

    /**
@@ -1826,6 +1838,7 @@ public class AppOpsManager {
            false, // ACCESS_MEDIA_LOCATION
            false, // QUERY_ALL_PACKAGES
            false, // MANAGE_EXTERNAL_STORAGE
            false, // INTERACT_ACROSS_PROFILES
    };

    /**
@@ -1925,6 +1938,7 @@ public class AppOpsManager {
            AppOpsManager.MODE_ALLOWED, // ALLOW_MEDIA_LOCATION
            AppOpsManager.MODE_DEFAULT, // QUERY_ALL_PACKAGES
            AppOpsManager.MODE_DEFAULT, // MANAGE_EXTERNAL_STORAGE
            AppOpsManager.MODE_DEFAULT, // INTERACT_ACROSS_PROFILES
    };

    /**
@@ -2028,6 +2042,7 @@ public class AppOpsManager {
            false, // ACCESS_MEDIA_LOCATION
            false, // QUERY_ALL_PACKAGES
            false, // MANAGE_EXTERNAL_STORAGE
            false, // INTERACT_ACROSS_PROFILES
    };

    /**
+2 −2
Original line number Diff line number Diff line
@@ -256,10 +256,10 @@ public final class AsyncNotedAppOp implements Parcelable {
    };

    @DataClass.Generated(
            time = 1576864422226L,
            time = 1578321462996L,
            codegenVersion = "1.0.14",
            sourceFile = "frameworks/base/core/java/android/app/AsyncNotedAppOp.java",
            inputSignatures = "private final @android.annotation.IntRange(from=0L, to=92L) int mOpCode\nprivate final @android.annotation.IntRange(from=0L) int mNotingUid\nprivate final @android.annotation.Nullable java.lang.String mFeatureId\nprivate final @android.annotation.NonNull java.lang.String mMessage\nprivate final @android.annotation.IntRange(from=0L) long mTime\npublic @android.annotation.NonNull java.lang.String getOp()\nclass AsyncNotedAppOp extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genAidl=true, genHiddenConstructor=true)")
            inputSignatures = "private final @android.annotation.IntRange(from=0L, to=93L) int mOpCode\nprivate final @android.annotation.IntRange(from=0L) int mNotingUid\nprivate final @android.annotation.Nullable java.lang.String mFeatureId\nprivate final @android.annotation.NonNull java.lang.String mMessage\nprivate final @android.annotation.IntRange(from=0L) long mTime\npublic @android.annotation.NonNull java.lang.String getOp()\nclass AsyncNotedAppOp extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genAidl=true, genHiddenConstructor=true)")
    @Deprecated
    private void __metadata() {}

+2 −6
Original line number Diff line number Diff line
@@ -2340,13 +2340,9 @@
    <permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL"
        android:protectionLevel="signature|installer|telephony" />

    <!-- @SystemApi Allows an application to start its own activities, but on a different profile
         associated with the user. For example, an application running on the main profile of a user
         can start an activity on a managed profile of that user.
         This permission is not available to third party applications.
         @hide -->
    <!-- Allows interaction across profiles in the same profile group. -->
    <permission android:name="android.permission.INTERACT_ACROSS_PROFILES"
        android:protectionLevel="signature|privileged" />
        android:protectionLevel="signature|appop|documenter|wellbeing" />

    <!-- @SystemApi @hide Allows an application to call APIs that allow it to query and manage
         users on the device. This permission is not available to