diff options
-rw-r--r-- | api/current.txt | 1 | ||||
-rw-r--r-- | api/system-current.txt | 1 | ||||
-rw-r--r-- | core/java/android/app/ActivityManagerNative.java | 23 | ||||
-rw-r--r-- | core/java/android/app/IActivityManager.java | 9 | ||||
-rw-r--r-- | core/java/android/app/admin/DevicePolicyManager.java | 18 | ||||
-rw-r--r-- | core/java/android/app/admin/IDevicePolicyManager.aidl | 2 | ||||
-rw-r--r-- | services/core/java/com/android/server/am/ActivityManagerService.java | 41 | ||||
-rw-r--r-- | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | 56 |
8 files changed, 9 insertions, 142 deletions
diff --git a/api/current.txt b/api/current.txt index 0228d49..0214001 100644 --- a/api/current.txt +++ b/api/current.txt @@ -5790,7 +5790,6 @@ package android.app.admin { method public void setPermissionPolicy(android.content.ComponentName, int); method public boolean setPermittedAccessibilityServices(android.content.ComponentName, java.util.List<java.lang.String>); method public boolean setPermittedInputMethods(android.content.ComponentName, java.util.List<java.lang.String>); - method public void setPreferredSetupActivity(android.content.ComponentName, android.content.ComponentName); method public void setProfileEnabled(android.content.ComponentName); method public void setProfileName(android.content.ComponentName, java.lang.String); method public void setRecommendedGlobalProxy(android.content.ComponentName, android.net.ProxyInfo); diff --git a/api/system-current.txt b/api/system-current.txt index 0d7a5b3..dc1e1fb 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -5900,7 +5900,6 @@ package android.app.admin { method public void setPermissionPolicy(android.content.ComponentName, int); method public boolean setPermittedAccessibilityServices(android.content.ComponentName, java.util.List<java.lang.String>); method public boolean setPermittedInputMethods(android.content.ComponentName, java.util.List<java.lang.String>); - method public void setPreferredSetupActivity(android.content.ComponentName, android.content.ComponentName); method public void setProfileEnabled(android.content.ComponentName); method public void setProfileName(android.content.ComponentName, java.lang.String); method public void setRecommendedGlobalProxy(android.content.ComponentName, android.net.ProxyInfo); diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java index bb553e4..dabcc50c 100644 --- a/core/java/android/app/ActivityManagerNative.java +++ b/core/java/android/app/ActivityManagerNative.java @@ -2534,15 +2534,6 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM return true; } - case UPDATE_PREFERRED_SETUP_ACTIVITY_TRANSACTION: { - data.enforceInterface(IActivityManager.descriptor); - ComponentName preferredActivity = ComponentName.readFromParcel(data); - int userId = data.readInt(); - updatePreferredSetupActivity(preferredActivity, userId); - reply.writeNoException(); - return true; - } - case GET_PACKAGE_PROCESS_STATE_TRANSACTION: { data.enforceInterface(IActivityManager.descriptor); String pkg = data.readString(); @@ -5868,20 +5859,6 @@ class ActivityManagerProxy implements IActivityManager } @Override - public void updatePreferredSetupActivity(ComponentName preferredActivity, int userId) - throws RemoteException { - Parcel data = Parcel.obtain(); - Parcel reply = Parcel.obtain(); - data.writeInterfaceToken(IActivityManager.descriptor); - ComponentName.writeToParcel(preferredActivity, data); - data.writeInt(userId); - mRemote.transact(UPDATE_PREFERRED_SETUP_ACTIVITY_TRANSACTION, data, reply, 0); - reply.readException(); - data.recycle(); - reply.recycle(); - } - - @Override public int getPackageProcessState(String packageName) throws RemoteException { Parcel data = Parcel.obtain(); Parcel reply = Parcel.obtain(); diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java index e87eabe..0d5e1c7 100644 --- a/core/java/android/app/IActivityManager.java +++ b/core/java/android/app/IActivityManager.java @@ -502,8 +502,6 @@ public interface IActivityManager extends IInterface { throws RemoteException; public void updateLockTaskPackages(int userId, String[] packages) throws RemoteException; public void updateDeviceOwner(String packageName) throws RemoteException; - public void updatePreferredSetupActivity(ComponentName preferredActivity, int userId) - throws RemoteException; public int getPackageProcessState(String packageName) throws RemoteException; @@ -850,8 +848,7 @@ public interface IActivityManager extends IInterface { int GET_PACKAGE_PROCESS_STATE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+293; int SHOW_LOCK_TASK_ESCAPE_MESSAGE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+294; int UPDATE_DEVICE_OWNER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+295; - int UPDATE_PREFERRED_SETUP_ACTIVITY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+296; - int KEYGUARD_GOING_AWAY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+297; - int REGISTER_UID_OBSERVER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+298; - int UNREGISTER_UID_OBSERVER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+299; + int KEYGUARD_GOING_AWAY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+296; + int REGISTER_UID_OBSERVER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+297; + int UNREGISTER_UID_OBSERVER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+298; } diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 55eaf27..3ab0e01 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -4404,24 +4404,6 @@ public class DevicePolicyManager { } /** - * Called by a device initializer to set the activity to be launched on device boot or after a - * user switch during user setup. This activity will be started regardless of the priority of - * other 'home' activities. Once user setup is complete, the preferred setup activity will be - * ignored. - * - * @param admin Which {@link DeviceAdminReceiver} this request is associated with. - * @param activity The Activity to be started by default during user setup. - */ - public void setPreferredSetupActivity(@NonNull ComponentName admin, - @NonNull ComponentName activity) { - try { - mService.setPreferredSetupActivity(admin, activity); - } catch (RemoteException re) { - Log.w(TAG, "Failed talking with device policy service", re); - } - } - - /** * Called by profile or device owners to set the default response for future runtime permission * requests by applications. The policy can allow for normal operation which prompts the * user to grant a permission, or can allow automatic granting or denying of runtime diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl index 477a338..8c7b20a 100644 --- a/core/java/android/app/admin/IDevicePolicyManager.aidl +++ b/core/java/android/app/admin/IDevicePolicyManager.aidl @@ -218,8 +218,6 @@ interface IDevicePolicyManager { String getDeviceInitializer(); ComponentName getDeviceInitializerComponent(); - void setPreferredSetupActivity(in ComponentName admin, in ComponentName activity); - void setUserIcon(in ComponentName admin, in Bitmap icon); void sendDeviceInitializerStatus(int statusCode, String description); diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 1046b29..bedc729 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -468,12 +468,6 @@ public final class ActivityManagerService extends ActivityManagerNative */ String mDeviceOwnerName; - /** - * Preferred activities to start on boot/user switch, as set by DevicePolicyManager. Indexed - * by userId. - */ - SparseArray<ComponentName> mPreferredSetupActivities = new SparseArray<>(); - public class PendingAssistExtras extends Binder implements Runnable { public final ActivityRecord activity; public final Bundle extras; @@ -3435,20 +3429,13 @@ public final class ActivityManagerService extends ActivityManagerNative // Factory test. ai = AppGlobals.getPackageManager().getActivityInfo(comp, flags, userId); } else { - ComponentName preferredComponent = mPreferredSetupActivities.get(userId); - if (preferredComponent != null) { - ai = AppGlobals.getPackageManager().getActivityInfo( - preferredComponent, flags, userId); - } - if (ai == null) { - ResolveInfo info = AppGlobals.getPackageManager().resolveIntent( - intent, - intent.resolveTypeIfNeeded(mContext.getContentResolver()), - flags, userId); + ResolveInfo info = AppGlobals.getPackageManager().resolveIntent( + intent, + intent.resolveTypeIfNeeded(mContext.getContentResolver()), + flags, userId); - if (info != null) { - ai = info.activityInfo; - } + if (info != null) { + ai = info.activityInfo; } } } catch (RemoteException e) { @@ -8919,22 +8906,6 @@ public final class ActivityManagerService extends ActivityManagerNative } @Override - public void updatePreferredSetupActivity(ComponentName preferredActivity, int userId) { - final int callingUid = Binder.getCallingUid(); - if (callingUid != 0 && callingUid != Process.SYSTEM_UID) { - throw new SecurityException( - "updatePreferredSetupActivity called from non-system process"); - } - synchronized (this) { - if (preferredActivity == null) { - mPreferredSetupActivities.delete(userId); - } else { - mPreferredSetupActivities.put(userId, preferredActivity); - } - } - } - - @Override public void updateDeviceOwner(String packageName) { final int callingUid = Binder.getCallingUid(); if (callingUid != 0 && callingUid != Process.SYSTEM_UID) { diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 825ef1a..feb0285 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -183,7 +183,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { private static final String ATTR_PERMISSION_PROVIDER = "permission-provider"; private static final String ATTR_SETUP_COMPLETE = "setup-complete"; - private static final String ATTR_PREFERRED_SETUP_ACTIVITY = "setup-activity"; private static final String ATTR_PERMISSION_POLICY = "permission-policy"; private static final String ATTR_DELEGATED_CERT_INSTALLER = "delegated-cert-installer"; @@ -335,8 +334,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { boolean doNotAskCredentialsOnBoot = false; - ComponentName mPreferredSetupActivity; - public DevicePolicyData(int userHandle) { mUserHandle = userHandle; } @@ -1436,12 +1433,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { out.attribute(null, ATTR_DELEGATED_CERT_INSTALLER, policy.mDelegatedCertInstallerPackage); } - if (policy.mPreferredSetupActivity != null) { - out.attribute(null, ATTR_PREFERRED_SETUP_ACTIVITY, - policy.mPreferredSetupActivity.flattenToString()); - } else { - out.attribute(null, ATTR_PREFERRED_SETUP_ACTIVITY, ""); - } final int N = policy.mAdminList.size(); for (int i=0; i<N; i++) { @@ -1566,12 +1557,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } policy.mDelegatedCertInstallerPackage = parser.getAttributeValue(null, ATTR_DELEGATED_CERT_INSTALLER); - String preferredSetupActivity = - parser.getAttributeValue(null, ATTR_PREFERRED_SETUP_ACTIVITY); - if (preferredSetupActivity != null) { - policy.mPreferredSetupActivity = - ComponentName.unflattenFromString(preferredSetupActivity); - } type = parser.next(); int outerDepth = parser.getDepth(); @@ -1695,7 +1680,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { if (policy.mStatusBarDisabled) { setStatusBarDisabledInternal(policy.mStatusBarDisabled, userHandle); } - updatePreferredSetupActivityLocked(userHandle); } private void updateLockTaskPackagesLocked(List<String> packages, int userId) { @@ -4734,43 +4718,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } @Override - public void setPreferredSetupActivity(ComponentName who, ComponentName activity) { - if (!mHasFeature) { - return; - } - Preconditions.checkNotNull(who, "ComponentName is null"); - synchronized (this) { - ActiveAdmin activeAdmin = - getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER); - if (!isDeviceInitializer(activeAdmin.info.getPackageName())) { - throw new SecurityException( - "This method can only be called by device initializers"); - } - int userHandle = UserHandle.getCallingUserId(); - DevicePolicyData userData = getUserData(userHandle); - userData.mPreferredSetupActivity = activity; - saveSettingsLocked(userHandle); - updatePreferredSetupActivityLocked(userHandle); - } - } - - private void updatePreferredSetupActivityLocked(int userHandle) { - if (!mHasFeature) { - return; - } - IActivityManager am = ActivityManagerNative.getDefault(); - long ident = Binder.clearCallingIdentity(); - try { - am.updatePreferredSetupActivity( - getUserData(userHandle).mPreferredSetupActivity, userHandle); - } catch (RemoteException e) { - // Not gonna happen. - } finally { - Binder.restoreCallingIdentity(ident); - } - } - - @Override public void setApplicationRestrictions(ComponentName who, String packageName, Bundle settings) { Preconditions.checkNotNull(who, "ComponentName is null"); final UserHandle userHandle = new UserHandle(UserHandle.getCallingUserId()); @@ -6138,9 +6085,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { if (!policy.mUserSetupComplete) { policy.mUserSetupComplete = true; synchronized (this) { - // Clear the preferred setup activity. - policy.mPreferredSetupActivity = null; - updatePreferredSetupActivityLocked(userHandle); // The DeviceInitializer was whitelisted but now should be removed. removeDeviceInitializerFromLockTaskPackages(userHandle); saveSettingsLocked(userHandle); |