Loading api/current.txt +2 −2 Original line number Diff line number Diff line Loading @@ -6392,7 +6392,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 isLogoutEnabled(); method public boolean isManagedProfile(android.content.ComponentName); method public boolean isMasterVolumeMuted(android.content.ComponentName); method public boolean isNetworkLoggingEnabled(android.content.ComponentName); Loading Loading @@ -6436,7 +6436,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 setLogoutEnabled(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); core/java/android/app/admin/DevicePolicyManager.java +11 −12 Original line number Diff line number Diff line Loading @@ -8535,32 +8535,31 @@ 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. * Called by a device owner to specify whether logout 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. * @param enabled whether logout 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"); public void setLogoutEnabled(@NonNull ComponentName admin, boolean enabled) { throwIfParentInstance("setLogoutEnabled"); try { mService.setLogoutButtonEnabled(admin, enabled); mService.setLogoutEnabled(admin, enabled); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** * Returns whether logout button is enabled by a device owner. * Returns whether logout is enabled by a device owner. * * @return {@code true} if logout button is enabled by device owner, {@code false} otherwise. * @return {@code true} if logout is enabled by device owner, {@code false} otherwise. */ public boolean isLogoutButtonEnabled() { throwIfParentInstance("isLogoutButtonEnabled"); public boolean isLogoutEnabled() { throwIfParentInstance("isLogoutEnabled"); try { return mService.isLogoutButtonEnabled(); return mService.isLogoutEnabled(); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } Loading core/java/android/app/admin/IDevicePolicyManager.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -370,6 +370,6 @@ interface IDevicePolicyManager { boolean clearApplicationUserData(in ComponentName admin, in String packageName, in IPackageDataObserver callback); void setLogoutButtonEnabled(in ComponentName admin, boolean enabled); boolean isLogoutButtonEnabled(); void setLogoutEnabled(in ComponentName admin, boolean enabled); boolean isLogoutEnabled(); } packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java +1 −1 Original line number Diff line number Diff line Loading @@ -333,7 +333,7 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener, } else if (GLOBAL_ACTION_KEY_RESTART.equals(actionKey)) { mItems.add(new RestartAction()); } else if (GLOBAL_ACTION_KEY_LOGOUT.equals(actionKey)) { if (mDevicePolicyManager.isLogoutButtonEnabled() if (mDevicePolicyManager.isLogoutEnabled() && getCurrentUser().id != UserHandle.USER_SYSTEM) { mItems.add(new LogoutAction()); mHasLogoutButton = true; Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +15 −16 Original line number Diff line number Diff line Loading @@ -79,7 +79,6 @@ import android.app.admin.DeviceAdminInfo; import android.app.admin.DeviceAdminReceiver; import android.app.admin.DevicePolicyManager; import android.app.admin.DevicePolicyManagerInternal; import android.app.admin.IDevicePolicyManager; import android.app.admin.NetworkEvent; import android.app.admin.PasswordMetrics; import android.app.admin.SecurityLog; Loading Loading @@ -737,7 +736,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { private static final String TAG_ORGANIZATION_NAME = "organization-name"; private static final String ATTR_LAST_NETWORK_LOGGING_NOTIFICATION = "last-notification"; private static final String ATTR_NUM_NETWORK_LOGGING_NOTIFICATIONS = "num-notifications"; private static final String TAG_IS_LOGOUT_BUTTON_ENABLED = "is_logout_button_enabled"; private static final String TAG_IS_LOGOUT_ENABLED = "is_logout_enabled"; final DeviceAdminInfo info; Loading Loading @@ -787,7 +786,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { boolean requireAutoTime = false; // Can only be set by a device owner. boolean forceEphemeralUsers = false; // Can only be set by a device owner. boolean isNetworkLoggingEnabled = false; // Can only be set by a device owner. boolean isLogoutButtonEnabled = false; // Can only be set by a device owner. boolean isLogoutEnabled = false; // Can only be set by a device owner. // one notification after enabling + one more after reboots static final int DEF_MAXIMUM_NETWORK_LOGGING_NOTIFICATIONS_SHOWN = 2; Loading Loading @@ -1105,10 +1104,10 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { out.text(organizationName); out.endTag(null, TAG_ORGANIZATION_NAME); } if (isLogoutButtonEnabled) { out.startTag(null, TAG_IS_LOGOUT_BUTTON_ENABLED); out.attribute(null, ATTR_VALUE, Boolean.toString(isLogoutButtonEnabled)); out.endTag(null, TAG_IS_LOGOUT_BUTTON_ENABLED); if (isLogoutEnabled) { out.startTag(null, TAG_IS_LOGOUT_ENABLED); out.attribute(null, ATTR_VALUE, Boolean.toString(isLogoutEnabled)); out.endTag(null, TAG_IS_LOGOUT_ENABLED); } } Loading Loading @@ -1283,8 +1282,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { } else { Log.w(LOG_TAG, "Missing text when loading organization name"); } } else if (TAG_IS_LOGOUT_BUTTON_ENABLED.equals(tag)) { isLogoutButtonEnabled = Boolean.parseBoolean( } else if (TAG_IS_LOGOUT_ENABLED.equals(tag)) { isLogoutEnabled = Boolean.parseBoolean( parser.getAttributeValue(null, ATTR_VALUE)); } else { Slog.w(LOG_TAG, "Unknown admin tag: " + tag); Loading Loading @@ -11530,35 +11529,35 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { } @Override public synchronized void setLogoutButtonEnabled(ComponentName admin, boolean enabled) { public synchronized void setLogoutEnabled(ComponentName admin, boolean enabled) { if (!mHasFeature) { return; } Preconditions.checkNotNull(admin); getActiveAdminForCallerLocked(admin, DeviceAdminInfo.USES_POLICY_DEVICE_OWNER); if (enabled == isLogoutButtonEnabledInternalLocked()) { if (enabled == isLogoutEnabledInternalLocked()) { // already in the requested state return; } ActiveAdmin deviceOwner = getDeviceOwnerAdminLocked(); deviceOwner.isLogoutButtonEnabled = enabled; deviceOwner.isLogoutEnabled = enabled; saveSettingsLocked(mInjector.userHandleGetCallingUserId()); } @Override public boolean isLogoutButtonEnabled() { public boolean isLogoutEnabled() { if (!mHasFeature) { return false; } synchronized (this) { return isLogoutButtonEnabledInternalLocked(); return isLogoutEnabledInternalLocked(); } } private boolean isLogoutButtonEnabledInternalLocked() { private boolean isLogoutEnabledInternalLocked() { ActiveAdmin deviceOwner = getDeviceOwnerAdminLocked(); return (deviceOwner != null) && deviceOwner.isLogoutButtonEnabled; return (deviceOwner != null) && deviceOwner.isLogoutEnabled; } } Loading
api/current.txt +2 −2 Original line number Diff line number Diff line Loading @@ -6392,7 +6392,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 isLogoutEnabled(); method public boolean isManagedProfile(android.content.ComponentName); method public boolean isMasterVolumeMuted(android.content.ComponentName); method public boolean isNetworkLoggingEnabled(android.content.ComponentName); Loading Loading @@ -6436,7 +6436,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 setLogoutEnabled(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);
core/java/android/app/admin/DevicePolicyManager.java +11 −12 Original line number Diff line number Diff line Loading @@ -8535,32 +8535,31 @@ 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. * Called by a device owner to specify whether logout 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. * @param enabled whether logout 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"); public void setLogoutEnabled(@NonNull ComponentName admin, boolean enabled) { throwIfParentInstance("setLogoutEnabled"); try { mService.setLogoutButtonEnabled(admin, enabled); mService.setLogoutEnabled(admin, enabled); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** * Returns whether logout button is enabled by a device owner. * Returns whether logout is enabled by a device owner. * * @return {@code true} if logout button is enabled by device owner, {@code false} otherwise. * @return {@code true} if logout is enabled by device owner, {@code false} otherwise. */ public boolean isLogoutButtonEnabled() { throwIfParentInstance("isLogoutButtonEnabled"); public boolean isLogoutEnabled() { throwIfParentInstance("isLogoutEnabled"); try { return mService.isLogoutButtonEnabled(); return mService.isLogoutEnabled(); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } Loading
core/java/android/app/admin/IDevicePolicyManager.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -370,6 +370,6 @@ interface IDevicePolicyManager { boolean clearApplicationUserData(in ComponentName admin, in String packageName, in IPackageDataObserver callback); void setLogoutButtonEnabled(in ComponentName admin, boolean enabled); boolean isLogoutButtonEnabled(); void setLogoutEnabled(in ComponentName admin, boolean enabled); boolean isLogoutEnabled(); }
packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialog.java +1 −1 Original line number Diff line number Diff line Loading @@ -333,7 +333,7 @@ class GlobalActionsDialog implements DialogInterface.OnDismissListener, } else if (GLOBAL_ACTION_KEY_RESTART.equals(actionKey)) { mItems.add(new RestartAction()); } else if (GLOBAL_ACTION_KEY_LOGOUT.equals(actionKey)) { if (mDevicePolicyManager.isLogoutButtonEnabled() if (mDevicePolicyManager.isLogoutEnabled() && getCurrentUser().id != UserHandle.USER_SYSTEM) { mItems.add(new LogoutAction()); mHasLogoutButton = true; Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +15 −16 Original line number Diff line number Diff line Loading @@ -79,7 +79,6 @@ import android.app.admin.DeviceAdminInfo; import android.app.admin.DeviceAdminReceiver; import android.app.admin.DevicePolicyManager; import android.app.admin.DevicePolicyManagerInternal; import android.app.admin.IDevicePolicyManager; import android.app.admin.NetworkEvent; import android.app.admin.PasswordMetrics; import android.app.admin.SecurityLog; Loading Loading @@ -737,7 +736,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { private static final String TAG_ORGANIZATION_NAME = "organization-name"; private static final String ATTR_LAST_NETWORK_LOGGING_NOTIFICATION = "last-notification"; private static final String ATTR_NUM_NETWORK_LOGGING_NOTIFICATIONS = "num-notifications"; private static final String TAG_IS_LOGOUT_BUTTON_ENABLED = "is_logout_button_enabled"; private static final String TAG_IS_LOGOUT_ENABLED = "is_logout_enabled"; final DeviceAdminInfo info; Loading Loading @@ -787,7 +786,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { boolean requireAutoTime = false; // Can only be set by a device owner. boolean forceEphemeralUsers = false; // Can only be set by a device owner. boolean isNetworkLoggingEnabled = false; // Can only be set by a device owner. boolean isLogoutButtonEnabled = false; // Can only be set by a device owner. boolean isLogoutEnabled = false; // Can only be set by a device owner. // one notification after enabling + one more after reboots static final int DEF_MAXIMUM_NETWORK_LOGGING_NOTIFICATIONS_SHOWN = 2; Loading Loading @@ -1105,10 +1104,10 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { out.text(organizationName); out.endTag(null, TAG_ORGANIZATION_NAME); } if (isLogoutButtonEnabled) { out.startTag(null, TAG_IS_LOGOUT_BUTTON_ENABLED); out.attribute(null, ATTR_VALUE, Boolean.toString(isLogoutButtonEnabled)); out.endTag(null, TAG_IS_LOGOUT_BUTTON_ENABLED); if (isLogoutEnabled) { out.startTag(null, TAG_IS_LOGOUT_ENABLED); out.attribute(null, ATTR_VALUE, Boolean.toString(isLogoutEnabled)); out.endTag(null, TAG_IS_LOGOUT_ENABLED); } } Loading Loading @@ -1283,8 +1282,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { } else { Log.w(LOG_TAG, "Missing text when loading organization name"); } } else if (TAG_IS_LOGOUT_BUTTON_ENABLED.equals(tag)) { isLogoutButtonEnabled = Boolean.parseBoolean( } else if (TAG_IS_LOGOUT_ENABLED.equals(tag)) { isLogoutEnabled = Boolean.parseBoolean( parser.getAttributeValue(null, ATTR_VALUE)); } else { Slog.w(LOG_TAG, "Unknown admin tag: " + tag); Loading Loading @@ -11530,35 +11529,35 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { } @Override public synchronized void setLogoutButtonEnabled(ComponentName admin, boolean enabled) { public synchronized void setLogoutEnabled(ComponentName admin, boolean enabled) { if (!mHasFeature) { return; } Preconditions.checkNotNull(admin); getActiveAdminForCallerLocked(admin, DeviceAdminInfo.USES_POLICY_DEVICE_OWNER); if (enabled == isLogoutButtonEnabledInternalLocked()) { if (enabled == isLogoutEnabledInternalLocked()) { // already in the requested state return; } ActiveAdmin deviceOwner = getDeviceOwnerAdminLocked(); deviceOwner.isLogoutButtonEnabled = enabled; deviceOwner.isLogoutEnabled = enabled; saveSettingsLocked(mInjector.userHandleGetCallingUserId()); } @Override public boolean isLogoutButtonEnabled() { public boolean isLogoutEnabled() { if (!mHasFeature) { return false; } synchronized (this) { return isLogoutButtonEnabledInternalLocked(); return isLogoutEnabledInternalLocked(); } } private boolean isLogoutButtonEnabledInternalLocked() { private boolean isLogoutEnabledInternalLocked() { ActiveAdmin deviceOwner = getDeviceOwnerAdminLocked(); return (deviceOwner != null) && deviceOwner.isLogoutButtonEnabled; return (deviceOwner != null) && deviceOwner.isLogoutEnabled; } }