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

Commit 6ab47fc1 authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Allow device initializers to set a preferred setup activity." into mnc-dev

parents 0c2d0deb 13c58bac
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -5781,6 +5781,7 @@ package android.app.admin {
    method public void setPasswordQuality(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);
+1 −0
Original line number Diff line number Diff line
@@ -5886,6 +5886,7 @@ package android.app.admin {
    method public void setPasswordQuality(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);
+23 −0
Original line number Diff line number Diff line
@@ -2521,6 +2521,15 @@ 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();
@@ -5820,6 +5829,20 @@ class ActivityManagerProxy implements IActivityManager
        reply.recycle();
    }

    @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();
+3 −0
Original line number Diff line number Diff line
@@ -496,6 +496,8 @@ 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;

@@ -839,4 +841,5 @@ 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;
}
+17 −0
Original line number Diff line number Diff line
@@ -4325,4 +4325,21 @@ 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(ComponentName admin, ComponentName activity) {
        try {
            mService.setPreferredSetupActivity(admin, activity);
        } catch (RemoteException re) {
            Log.w(TAG, "Failed talking with device policy service", re);
        }
    }
}
Loading