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

Commit 1beccb0f authored by Alex Chau's avatar Alex Chau Committed by Android (Google) Code Review
Browse files

Merge "Introduce logout button and DevicePolicyManager API to enable it"

parents d5b9266f 04458859
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -6390,6 +6390,7 @@ package android.app.admin {
    method public deprecated boolean isCallerApplicationRestrictionsManagingPackage();
    method public boolean isDeviceOwnerApp(java.lang.String);
    method public boolean isLockTaskPermitted(java.lang.String);
    method public boolean isLogoutButtonEnabled();
    method public boolean isManagedProfile(android.content.ComponentName);
    method public boolean isMasterVolumeMuted(android.content.ComponentName);
    method public boolean isNetworkLoggingEnabled(android.content.ComponentName);
@@ -6432,6 +6433,7 @@ package android.app.admin {
    method public void setKeyguardDisabledFeatures(android.content.ComponentName, int);
    method public void setLockTaskFeatures(android.content.ComponentName, int);
    method public void setLockTaskPackages(android.content.ComponentName, java.lang.String[]) throws java.lang.SecurityException;
    method public void setLogoutButtonEnabled(android.content.ComponentName, boolean);
    method public void setLongSupportMessage(android.content.ComponentName, java.lang.CharSequence);
    method public void setMasterVolumeMuted(android.content.ComponentName, boolean);
    method public void setMaximumFailedPasswordsForWipe(android.content.ComponentName, int);
+32 −0
Original line number Diff line number Diff line
@@ -8474,6 +8474,38 @@ public class DevicePolicyManager {
        }
    }

    /**
     * Called by a device owner to specify whether a logout button is enabled for all secondary
     * users. The system may show a logout button that stops the user and switches back to the
     * primary user.
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
     * @param enabled whether logout button should be enabled or not.
     * @throws SecurityException if {@code admin} is not a device owner.
     */
    public void setLogoutButtonEnabled(@NonNull ComponentName admin, boolean enabled) {
        throwIfParentInstance("setLogoutButtonEnabled");
        try {
            mService.setLogoutButtonEnabled(admin, enabled);
        } catch (RemoteException re) {
            throw re.rethrowFromSystemServer();
        }
    }

    /**
     * Returns whether logout button is enabled by a device owner.
     *
     * @return {@code true} if logout button is enabled by device owner, {@code false} otherwise.
     */
    public boolean isLogoutButtonEnabled() {
        throwIfParentInstance("isLogoutButtonEnabled");
        try {
            return mService.isLogoutButtonEnabled();
        } catch (RemoteException re) {
            throw re.rethrowFromSystemServer();
        }
    }

    /**
     * Callback used in {@link #clearApplicationUserData}
     * to indicate that the clearing of an application's user data is done.
+3 −0
Original line number Diff line number Diff line
@@ -366,4 +366,7 @@ interface IDevicePolicyManager {
    StringParceledListSlice getOwnerInstalledCaCerts(in UserHandle user);

    boolean clearApplicationUserData(in ComponentName admin, in String packageName, in IPackageDataObserver callback);

    void setLogoutButtonEnabled(in ComponentName admin, boolean enabled);
    boolean isLogoutButtonEnabled();
}
+15 −0
Original line number Diff line number Diff line
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0">
    <group>
        <clip-path android:pathData="M0,0h24v24H0V0z M 0,0" />
    <path
        android:fillColor="#FF000000"
        android:pathData="M17.0,7.0l-1.4099998,1.4099998l2.58,2.5900002l-10.17,0.0l0.0,2.0l10.17,0.0l-2.58,2.58l1.4099998,1.4200001l5.0,-5.0z"/>
    <path
        android:fillColor="#FF000000"
        android:pathData="M4,5h8V3H4C2.9,3,2,3.9,2,5v14c0,1.1,0.9,2,2,2h8v-2H4V5z"/>
    </group>
</vector>
+2 −0
Original line number Diff line number Diff line
@@ -2441,10 +2441,12 @@
         "users" = list of users
         "restart" = restart device
         "lockdown" = Lock down device until the user authenticates
         "logout" =  Logout the current user
         -->
    <string-array translatable="false" name="config_globalActionsList">
        <item>power</item>
        <item>restart</item>
        <item>logout</item>
        <item>bugreport</item>
        <item>users</item>
        <item>lockdown</item>
Loading