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

Commit e282c97e authored by Nicolas Prevot's avatar Nicolas Prevot Committed by Android (Google) Code Review
Browse files

Merge "Rename code related to cross-profile intents."

parents 0bc8b071 81948990
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -5154,10 +5154,10 @@ package android.app.admin {
  }
  public class DevicePolicyManager {
    method public void addForwardingIntentFilter(android.content.ComponentName, android.content.IntentFilter, int);
    method public void addCrossProfileIntentFilter(android.content.ComponentName, android.content.IntentFilter, int);
    method public void addPersistentPreferredActivity(android.content.ComponentName, android.content.IntentFilter, android.content.ComponentName);
    method public void addUserRestriction(android.content.ComponentName, java.lang.String);
    method public void clearForwardingIntentFilters(android.content.ComponentName);
    method public void clearCrossProfileIntentFilters(android.content.ComponentName);
    method public void clearPackagePersistentPreferredActivities(android.content.ComponentName, java.lang.String);
    method public void clearUserRestriction(android.content.ComponentName, java.lang.String);
    method public android.os.UserHandle createUser(android.content.ComponentName, java.lang.String);
@@ -5232,8 +5232,8 @@ package android.app.admin {
    field public static final java.lang.String EXTRA_DEVICE_ADMIN = "android.app.extra.DEVICE_ADMIN";
    field public static final java.lang.String EXTRA_PROVISIONING_DEFAULT_MANAGED_PROFILE_NAME = "defaultManagedProfileName";
    field public static final java.lang.String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME = "deviceAdminPackageName";
    field public static int FLAG_TO_MANAGED_PROFILE;
    field public static int FLAG_TO_PRIMARY_USER;
    field public static int FLAG_MANAGED_CAN_ACCESS_PARENT;
    field public static int FLAG_PARENT_CAN_ACCESS_MANAGED;
    field public static final int KEYGUARD_DISABLE_FEATURES_ALL = 2147483647; // 0x7fffffff
    field public static final int KEYGUARD_DISABLE_FEATURES_NONE = 0; // 0x0
    field public static final int KEYGUARD_DISABLE_SECURE_CAMERA = 2; // 0x2
+22 −5
Original line number Diff line number Diff line
@@ -1455,10 +1455,10 @@ final class ApplicationPackageManager extends PackageManager {
     * @hide
     */
    @Override
    public void addForwardingIntentFilter(IntentFilter filter, boolean removable, int userIdOrig,
            int userIdDest) {
    public void addCrossProfileIntentFilter(IntentFilter filter, boolean removable,
            int sourceUserId, int targetUserId) {
        try {
            mPM.addForwardingIntentFilter(filter, removable, userIdOrig, userIdDest);
            mPM.addCrossProfileIntentFilter(filter, removable, sourceUserId, targetUserId);
        } catch (RemoteException e) {
            // Should never happen!
        }
@@ -1468,14 +1468,31 @@ final class ApplicationPackageManager extends PackageManager {
     * @hide
     */
    @Override
    public void clearForwardingIntentFilters(int userIdOrig) {
    public void addForwardingIntentFilter(IntentFilter filter, boolean removable, int sourceUserId,
            int targetUserId) {
        addCrossProfileIntentFilter(filter, removable, sourceUserId, targetUserId);
    }

    /**
     * @hide
     */
    @Override
    public void clearCrossProfileIntentFilters(int sourceUserId) {
        try {
            mPM.clearForwardingIntentFilters(userIdOrig);
            mPM.clearCrossProfileIntentFilters(sourceUserId);
        } catch (RemoteException e) {
            // Should never happen!
        }
    }

    /**
     * @hide
     */
    @Override
    public void clearForwardingIntentFilters(int sourceUserId) {
        clearCrossProfileIntentFilters(sourceUserId);
    }

    private final ContextImpl mContext;
    private final IPackageManager mPM;

+16 −16
Original line number Diff line number Diff line
@@ -176,15 +176,16 @@ public class DevicePolicyManager {
    public static final String ACTION_SET_NEW_PASSWORD
            = "android.app.action.SET_NEW_PASSWORD";
    /**
     * Flag for {@link #addForwardingIntentFilter}: the intents will forwarded to the primary user.
     * Flag used by {@link #addCrossProfileIntentFilter} to allow access of certain intents from a
     * managed profile to its parent.
     */
    public static int FLAG_TO_PRIMARY_USER = 0x0001;
    public static int FLAG_PARENT_CAN_ACCESS_MANAGED = 0x0001;

    /**
     * Flag for {@link #addForwardingIntentFilter}: the intents will be forwarded to the managed
     * profile.
     * Flag used by {@link #addCrossProfileIntentFilter} to allow access of certain intents from the
     * parent to its managed profile.
     */
    public static int FLAG_TO_MANAGED_PROFILE = 0x0002;
    public static int FLAG_MANAGED_CAN_ACCESS_PARENT = 0x0002;

    /**
     * Return true if the given administrator component is currently
@@ -1951,17 +1952,16 @@ public class DevicePolicyManager {
    }

    /**
     * Called by a profile owner to forward intents sent from the managed profile to the owner, or
     * from the owner to the managed profile.
     * If an intent matches this intent filter, then activities belonging to the other user can
     * respond to this intent.
     * Called by the profile owner so that some intents sent in the managed profile can also be
     * resolved in the parent, or vice versa.
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
     * @param filter if an intent matches this IntentFilter, then it can be forwarded.
     * @param filter The {@link IntentFilter} the intent has to match to be also resolved in the
     * other profile
     */
    public void addForwardingIntentFilter(ComponentName admin, IntentFilter filter, int flags) {
    public void addCrossProfileIntentFilter(ComponentName admin, IntentFilter filter, int flags) {
        if (mService != null) {
            try {
                mService.addForwardingIntentFilter(admin, filter, flags);
                mService.addCrossProfileIntentFilter(admin, filter, flags);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed talking with device policy service", e);
            }
@@ -1969,14 +1969,14 @@ public class DevicePolicyManager {
    }

    /**
     * Called by a profile owner to remove the forwarding intent filters from the current user
     * and from the owner.
     * Called by a profile owner to remove the cross-profile intent filters from the managed profile
     * and from the parent.
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
     */
    public void clearForwardingIntentFilters(ComponentName admin) {
    public void clearCrossProfileIntentFilters(ComponentName admin) {
        if (mService != null) {
            try {
                mService.clearForwardingIntentFilters(admin);
                mService.clearCrossProfileIntentFilters(admin);
            } catch (RemoteException e) {
                Log.w(TAG, "Failed talking with device policy service", e);
            }
+2 −2
Original line number Diff line number Diff line
@@ -122,8 +122,8 @@ interface IDevicePolicyManager {
    Bundle getApplicationRestrictions(in ComponentName who, in String packageName);

    void setUserRestriction(in ComponentName who, in String key, boolean enable);
    void addForwardingIntentFilter(in ComponentName admin, in IntentFilter filter, int flags);
    void clearForwardingIntentFilters(in ComponentName admin);
    void addCrossProfileIntentFilter(in ComponentName admin, in IntentFilter filter, int flags);
    void clearCrossProfileIntentFilters(in ComponentName admin);

    boolean setApplicationBlocked(in ComponentName admin, in String packageName, boolean blocked);
    int setApplicationsBlocked(in ComponentName admin, in Intent intent, boolean blocked);
+4 −4
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ interface IPackageManager {

    ResolveInfo resolveIntent(in Intent intent, String resolvedType, int flags, int userId);

    boolean canForwardTo(in Intent intent, String resolvedType, int userIdFrom, int userIdDest);
    boolean canForwardTo(in Intent intent, String resolvedType, int sourceUserId, int targetUserId);

    List<ResolveInfo> queryIntentActivities(in Intent intent, 
            String resolvedType, int flags, int userId);
@@ -248,10 +248,10 @@ interface IPackageManager {

    void clearPackagePersistentPreferredActivities(String packageName, int userId);

    void addForwardingIntentFilter(in IntentFilter filter, boolean removable, int userIdOrig,
            int userIdDest);
    void addCrossProfileIntentFilter(in IntentFilter filter, boolean removable, int sourceUserId,
            int targetUserId);

    void clearForwardingIntentFilters(int userIdOrig);
    void clearCrossProfileIntentFilters(int sourceUserId);

    /**
     * Report the set of 'Home' activity candidates, plus (if any) which of them
Loading