am c4aa3c78: Merge "Add status bar flag to disable quick settings" into mnc-dev
* commit 'c4aa3c781a0ddce64853cd5d88bf97f8a9faf98b': Add status bar flag to disable quick settings
This commit is contained in:
@@ -63,12 +63,20 @@ public class StatusBarManager {
|
||||
| DISABLE_SYSTEM_INFO | DISABLE_RECENT | DISABLE_HOME | DISABLE_BACK | DISABLE_CLOCK
|
||||
| DISABLE_SEARCH;
|
||||
|
||||
/**
|
||||
* Flag to disable quick settings.
|
||||
*
|
||||
* Setting this flag disables quick settings completely, but does not disable expanding the
|
||||
* notification shade.
|
||||
*/
|
||||
public static final int DISABLE2_QUICK_SETTINGS = 0x00000001;
|
||||
|
||||
public static final int DISABLE2_NONE = 0x00000000;
|
||||
|
||||
public static final int DISABLE2_MASK = 0x00000000;
|
||||
public static final int DISABLE2_MASK = DISABLE2_QUICK_SETTINGS;
|
||||
|
||||
@IntDef(flag = true,
|
||||
value = {DISABLE2_NONE, DISABLE2_MASK})
|
||||
value = {DISABLE2_NONE, DISABLE2_MASK, DISABLE2_QUICK_SETTINGS})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface Disable2Flags {}
|
||||
|
||||
|
||||
@@ -1293,13 +1293,20 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
updateClearAll();
|
||||
updateEmptyShadeView();
|
||||
|
||||
// Disable QS if device not provisioned.
|
||||
// If the user switcher is simple then disable QS during setup because
|
||||
// the user intends to use the lock screen user switcher, QS in not needed.
|
||||
updateQsExpansionEnabled();
|
||||
mShadeUpdates.check();
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable QS if device not provisioned.
|
||||
* If the user switcher is simple then disable QS during setup because
|
||||
* the user intends to use the lock screen user switcher, QS in not needed.
|
||||
*/
|
||||
private void updateQsExpansionEnabled() {
|
||||
mNotificationPanel.setQsExpansionEnabled(isDeviceProvisioned()
|
||||
&& (mUserSetup || mUserSwitcherController == null
|
||||
|| !mUserSwitcherController.isSimpleUserSwitcher()));
|
||||
mShadeUpdates.check();
|
||||
|| !mUserSwitcherController.isSimpleUserSwitcher())
|
||||
&& ((mDisabled2 & StatusBarManager.DISABLE2_QUICK_SETTINGS) == 0));
|
||||
}
|
||||
|
||||
private void updateNotificationShadeForChildren() {
|
||||
@@ -1732,6 +1739,9 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
flagdbg.append(((diff1 & StatusBarManager.DISABLE_CLOCK) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state1 & StatusBarManager.DISABLE_SEARCH) != 0) ? "SEARCH" : "search");
|
||||
flagdbg.append(((diff1 & StatusBarManager.DISABLE_SEARCH) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state2 & StatusBarManager.DISABLE2_QUICK_SETTINGS) != 0) ? "QUICK_SETTINGS"
|
||||
: "quick_settings");
|
||||
flagdbg.append(((diff2 & StatusBarManager.DISABLE2_QUICK_SETTINGS) != 0) ? "* " : " ");
|
||||
flagdbg.append(">");
|
||||
Log.d(TAG, flagdbg.toString());
|
||||
|
||||
@@ -1780,6 +1790,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
(state1 & StatusBarManager.DISABLE_NOTIFICATION_ALERTS) != 0;
|
||||
mHeadsUpObserver.onChange(true);
|
||||
}
|
||||
|
||||
if ((diff2 & StatusBarManager.DISABLE2_QUICK_SETTINGS) != 0) {
|
||||
updateQsExpansionEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -192,6 +192,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
StatusBarManager.DISABLE_NOTIFICATION_ALERTS |
|
||||
StatusBarManager.DISABLE_SEARCH;
|
||||
|
||||
private static final int STATUS_BAR_DISABLE2_MASK =
|
||||
StatusBarManager.DISABLE2_QUICK_SETTINGS;
|
||||
|
||||
private static final Set<String> DEVICE_OWNER_USER_RESTRICTIONS;
|
||||
static {
|
||||
DEVICE_OWNER_USER_RESTRICTIONS = new HashSet();
|
||||
@@ -6040,8 +6043,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
IStatusBarService statusBarService = IStatusBarService.Stub.asInterface(
|
||||
ServiceManager.checkService(Context.STATUS_BAR_SERVICE));
|
||||
if (statusBarService != null) {
|
||||
int flags = enabled ? StatusBarManager.DISABLE_NONE : STATUS_BAR_DISABLE_MASK;
|
||||
statusBarService.disableForUser(flags, mToken, mContext.getPackageName(), userId);
|
||||
int flags1 = enabled ? StatusBarManager.DISABLE_NONE : STATUS_BAR_DISABLE_MASK;
|
||||
int flags2 = enabled ? StatusBarManager.DISABLE2_NONE : STATUS_BAR_DISABLE2_MASK;
|
||||
statusBarService.disableForUser(flags1, mToken, mContext.getPackageName(), userId);
|
||||
statusBarService.disable2ForUser(flags2, mToken, mContext.getPackageName(), userId);
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(LOG_TAG, "Failed to disable the status bar", e);
|
||||
|
||||
Reference in New Issue
Block a user