diff options
| author | 2024-02-13 22:38:02 +0000 | |
|---|---|---|
| committer | 2024-02-13 22:38:02 +0000 | |
| commit | 7c7244343baeda795c909a21a9c251c25219c538 (patch) | |
| tree | 5bc91e453a9ea9e8b6be19e48034cb74cbe53493 | |
| parent | 73f19c966755446215202010ae90ab4655466d91 (diff) | |
| parent | c49cc7d11489ea39c386a689e925ce2494270e56 (diff) | |
Merge "Improve StatusBarManager disable*() apis" into main
15 files changed, 561 insertions, 150 deletions
diff --git a/core/api/system-current.txt b/core/api/system-current.txt index e0824ccb17ee..97995fe8be08 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -1133,13 +1133,17 @@ package android.app { field public static final int NAV_BAR_MODE_KIDS = 1; // 0x1 } - public static final class StatusBarManager.DisableInfo { + public static final class StatusBarManager.DisableInfo implements android.os.Parcelable { method public boolean areAllComponentsEnabled(); + method public int describeContents(); + method public boolean isBackDisabled(); method public boolean isNavigateToHomeDisabled(); method public boolean isNotificationPeekingDisabled(); method public boolean isRecentsDisabled(); method public boolean isSearchDisabled(); method public boolean isStatusBarExpansionDisabled(); + method public void writeToParcel(@NonNull android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.app.StatusBarManager.DisableInfo> CREATOR; } public final class SystemServiceRegistry { diff --git a/core/api/system-lint-baseline.txt b/core/api/system-lint-baseline.txt index 8a485d2a8449..a6505c8b6093 100644 --- a/core/api/system-lint-baseline.txt +++ b/core/api/system-lint-baseline.txt @@ -1927,6 +1927,10 @@ UnflaggedApi: android.app.ActivityManager#getExternalHistoricalProcessStartReaso New API must be flagged with @FlaggedApi: method android.app.ActivityManager.getExternalHistoricalProcessStartReasons(String,int) UnflaggedApi: android.app.AppOpsManager#OPSTR_RECEIVE_SANDBOX_TRIGGER_AUDIO: New API must be flagged with @FlaggedApi: field android.app.AppOpsManager.OPSTR_RECEIVE_SANDBOX_TRIGGER_AUDIO +UnflaggedApi: android.app.StatusBarManager.DisableInfo#CREATOR: + New API must be flagged with @FlaggedApi: field android.app.StatusBarManager.DisableInfo.CREATOR +UnflaggedApi: android.app.StatusBarManager.DisableInfo#isBackDisabled(): + New API must be flagged with @FlaggedApi: method android.app.StatusBarManager.DisableInfo.isBackDisabled() UnflaggedApi: android.companion.virtual.VirtualDeviceManager.VirtualDevice#getPersistentDeviceId(): New API must be flagged with @FlaggedApi: method android.companion.virtual.VirtualDeviceManager.VirtualDevice.getPersistentDeviceId() UnflaggedApi: android.content.Context#THREAD_NETWORK_SERVICE: diff --git a/core/api/test-current.txt b/core/api/test-current.txt index 9f3d16e1f30b..bb98770eafee 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -463,7 +463,7 @@ package android.app { method @RequiresPermission(android.Manifest.permission.STATUS_BAR) public void togglePanel(); } - public static final class StatusBarManager.DisableInfo { + public static final class StatusBarManager.DisableInfo implements android.os.Parcelable { method public boolean isRotationSuggestionDisabled(); } diff --git a/core/java/android/app/StatusBarManager.aidl b/core/java/android/app/StatusBarManager.aidl new file mode 100644 index 000000000000..687678c4ea8d --- /dev/null +++ b/core/java/android/app/StatusBarManager.aidl @@ -0,0 +1,19 @@ +/** + * Copyright (c) 2024, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.app; + +parcelable StatusBarManager.DisableInfo;
\ No newline at end of file diff --git a/core/java/android/app/StatusBarManager.java b/core/java/android/app/StatusBarManager.java index 14195c473c6d..e6e46ddaa420 100644 --- a/core/java/android/app/StatusBarManager.java +++ b/core/java/android/app/StatusBarManager.java @@ -21,6 +21,7 @@ import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; +import android.annotation.SuppressLint; import android.annotation.SystemApi; import android.annotation.SystemService; import android.annotation.TestApi; @@ -43,6 +44,7 @@ import android.os.Binder; import android.os.Build; import android.os.Bundle; import android.os.IBinder; +import android.os.Parcelable; import android.os.RemoteException; import android.os.ServiceManager; import android.os.UserHandle; @@ -57,6 +59,7 @@ import com.android.internal.statusbar.IAddTileResultCallback; import com.android.internal.statusbar.IStatusBarService; import com.android.internal.statusbar.IUndoMediaTransferCallback; import com.android.internal.statusbar.NotificationVisibility; +import com.android.internal.util.DataClass; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -629,38 +632,49 @@ public class StatusBarManager { } /** - * Disable some features in the status bar. Pass the bitwise-or of the DISABLE_* flags. - * To re-enable everything, pass {@link #DISABLE_NONE}. + * @deprecated + * Disable some features in the status bar. Pass the bitwise-or of the DISABLE_* + * flags. To re-enable everything, pass {@link #DISABLE_NONE}. + * + * This method is deprecated and callers should use + * {@link #requestDisabledComponent(DisableInfo, String)} * * @hide */ + @Deprecated @UnsupportedAppUsage public void disable(int what) { - try { - final int userId = Binder.getCallingUserHandle().getIdentifier(); - final IStatusBarService svc = getService(); - if (svc != null) { - svc.disableForUser(what, mToken, mContext.getPackageName(), userId); - } - } catch (RemoteException ex) { - throw ex.rethrowFromSystemServer(); - } + requestDisabledComponent(new DisableInfo(what & DISABLE_MASK, what & DISABLE2_MASK), null); } /** - * Disable additional status bar features. Pass the bitwise-or of the DISABLE2_* flags. - * To re-enable everything, pass {@link #DISABLE_NONE}. + * @deprecated + * Disable some features in the status bar. Pass the bitwise-or of the DISABLE_2* + * flags. To re-enable everything, pass {@link #DISABLE2_NONE}. * - * Warning: Only pass DISABLE2_* flags into this function, do not use DISABLE_* flags. + * This method is deprecated and callers should use + * {@link #requestDisabledComponent(DisableInfo, String)} * * @hide */ - public void disable2(@Disable2Flags int what) { + @Deprecated + @UnsupportedAppUsage + public void disable2(int what) { + requestDisabledComponent(new DisableInfo(what & DISABLE_MASK, what & DISABLE2_MASK), null); + } + + /** + * Disable some features in the status bar. Pass a DisableInfo object with the required flags. + * + * @hide + */ + @UnsupportedAppUsage + public void requestDisabledComponent(DisableInfo disableInfo, String reason) { try { final int userId = Binder.getCallingUserHandle().getIdentifier(); final IStatusBarService svc = getService(); if (svc != null) { - svc.disable2ForUser(what, mToken, mContext.getPackageName(), userId); + svc.disableForUser(disableInfo, mToken, mContext.getPackageName(), userId, reason); } } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); @@ -888,18 +902,9 @@ public class StatusBarManager { @SystemApi @RequiresPermission(android.Manifest.permission.STATUS_BAR) public void setDisabledForSetup(boolean disabled) { - try { - final int userId = Binder.getCallingUserHandle().getIdentifier(); - final IStatusBarService svc = getService(); - if (svc != null) { - svc.disableForUser(disabled ? DEFAULT_SETUP_DISABLE_FLAGS : DISABLE_NONE, - mToken, mContext.getPackageName(), userId); - svc.disable2ForUser(disabled ? DEFAULT_SETUP_DISABLE2_FLAGS : DISABLE2_NONE, - mToken, mContext.getPackageName(), userId); - } - } catch (RemoteException ex) { - throw ex.rethrowFromSystemServer(); - } + int flags1 = disabled ? DEFAULT_SETUP_DISABLE_FLAGS : DISABLE_NONE; + DisableInfo info = new DisableInfo(flags1, DISABLE2_NONE); + requestDisabledComponent(info, "setDisabledForSetup"); } /** @@ -914,16 +919,9 @@ public class StatusBarManager { @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) @RequiresPermission(android.Manifest.permission.STATUS_BAR) public void setExpansionDisabledForSimNetworkLock(boolean disabled) { - try { - final int userId = Binder.getCallingUserHandle().getIdentifier(); - final IStatusBarService svc = getService(); - if (svc != null) { - svc.disableForUser(disabled ? DEFAULT_SIM_LOCKED_DISABLED_FLAGS : DISABLE_NONE, - mToken, mContext.getPackageName(), userId); - } - } catch (RemoteException ex) { - throw ex.rethrowFromSystemServer(); - } + int flags1 = disabled ? DEFAULT_SIM_LOCKED_DISABLED_FLAGS : DISABLE_NONE; + DisableInfo info = new DisableInfo(flags1, DISABLE2_NONE); + requestDisabledComponent(info, "setExpansionDisabledForSimNetworkLock"); } /** @@ -1315,33 +1313,75 @@ public class StatusBarManager { * @hide */ @SystemApi - public static final class DisableInfo { + @DataClass + public static final class DisableInfo implements Parcelable { + /** + * @hide + */ private boolean mStatusBarExpansion; + /** + * @hide + */ private boolean mNavigateHome; + /** + * @hide + */ private boolean mNotificationPeeking; + /** + * @hide + */ private boolean mRecents; + /** + * @hide + */ + private boolean mBack; + /** + * @hide + */ private boolean mSearch; + /** + * @hide + */ private boolean mSystemIcons; + /** + * @hide + */ private boolean mClock; + /** + * @hide + */ private boolean mNotificationIcons; + /** + * @hide + */ private boolean mRotationSuggestion; + /** + * @hide + */ + private boolean mNotificationTicker; /** @hide */ + @SuppressLint("UnflaggedApi") public DisableInfo(int flags1, int flags2) { mStatusBarExpansion = (flags1 & DISABLE_EXPAND) != 0; mNavigateHome = (flags1 & DISABLE_HOME) != 0; mNotificationPeeking = (flags1 & DISABLE_NOTIFICATION_ALERTS) != 0; mRecents = (flags1 & DISABLE_RECENT) != 0; + mBack = (flags1 & DISABLE_BACK) != 0; mSearch = (flags1 & DISABLE_SEARCH) != 0; mSystemIcons = (flags1 & DISABLE_SYSTEM_INFO) != 0; mClock = (flags1 & DISABLE_CLOCK) != 0; mNotificationIcons = (flags1 & DISABLE_NOTIFICATION_ICONS) != 0; + mNotificationTicker = (flags1 & DISABLE_NOTIFICATION_TICKER) != 0; mRotationSuggestion = (flags2 & DISABLE2_ROTATE_SUGGESTIONS) != 0; } /** @hide */ - public DisableInfo() {} + @SuppressLint("UnflaggedApi") + public DisableInfo() { + setEnableAll(); + } /** * @return {@code true} if expanding the notification shade is disabled @@ -1369,7 +1409,7 @@ public class StatusBarManager { } /** * @hide */ - public void setNagivationHomeDisabled(boolean disabled) { + public void setNavigationHomeDisabled(boolean disabled) { mNavigateHome = disabled; } @@ -1404,6 +1444,21 @@ public class StatusBarManager { } /** + * @return {@code true} if mBack is disabled + * + * @hide + */ + @SystemApi + public boolean isBackDisabled() { + return mBack; + } + + /** @hide */ + public void setBackDisabled(boolean disabled) { + mBack = disabled; + } + + /** * @return {@code true} if mSearch is disabled * * @hide @@ -1461,6 +1516,20 @@ public class StatusBarManager { } /** + * @return {@code true} if notification ticker is disabled + * + * @hide + */ + public boolean isNotificationTickerDisabled() { + return mNotificationTicker; + } + + /** * @hide */ + public void setNotificationTickerDisabled(boolean disabled) { + mNotificationTicker = disabled; + } + + /** * Returns whether the rotation suggestion is disabled. * * @hide @@ -1470,6 +1539,11 @@ public class StatusBarManager { return mRotationSuggestion; } + /** * @hide */ + public void setRotationSuggestionDisabled(boolean disabled) { + mNotificationIcons = disabled; + } + /** * @return {@code true} if no components are disabled (default state) * @hide @@ -1477,8 +1551,8 @@ public class StatusBarManager { @SystemApi public boolean areAllComponentsEnabled() { return !mStatusBarExpansion && !mNavigateHome && !mNotificationPeeking && !mRecents - && !mSearch && !mSystemIcons && !mClock && !mNotificationIcons - && !mRotationSuggestion; + && !mBack && !mSearch && !mSystemIcons && !mClock && !mNotificationIcons + && !mNotificationTicker && !mRotationSuggestion; } /** @hide */ @@ -1487,10 +1561,12 @@ public class StatusBarManager { mNavigateHome = false; mNotificationPeeking = false; mRecents = false; + mBack = false; mSearch = false; mSystemIcons = false; mClock = false; mNotificationIcons = false; + mNotificationTicker = false; mRotationSuggestion = false; } @@ -1500,9 +1576,9 @@ public class StatusBarManager { * @hide */ public boolean areAllComponentsDisabled() { - return mStatusBarExpansion && mNavigateHome && mNotificationPeeking - && mRecents && mSearch && mSystemIcons && mClock && mNotificationIcons - && mRotationSuggestion; + return mStatusBarExpansion && mNavigateHome && mNotificationPeeking && mRecents && mBack + && mSearch && mSystemIcons && mClock && mNotificationIcons + && mNotificationTicker && mRotationSuggestion; } /** @hide */ @@ -1511,10 +1587,12 @@ public class StatusBarManager { mNavigateHome = true; mNotificationPeeking = true; mRecents = true; + mBack = true; mSearch = true; mSystemIcons = true; mClock = true; mNotificationIcons = true; + mNotificationTicker = true; mRotationSuggestion = true; } @@ -1522,16 +1600,19 @@ public class StatusBarManager { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append("DisableInfo: "); + + sb.append("Disable Info: "); sb.append(" mStatusBarExpansion=").append(mStatusBarExpansion ? "disabled" : "enabled"); sb.append(" mNavigateHome=").append(mNavigateHome ? "disabled" : "enabled"); sb.append(" mNotificationPeeking=") .append(mNotificationPeeking ? "disabled" : "enabled"); sb.append(" mRecents=").append(mRecents ? "disabled" : "enabled"); + sb.append(" mBack=").append(mBack ? "disabled" : "enabled"); sb.append(" mSearch=").append(mSearch ? "disabled" : "enabled"); sb.append(" mSystemIcons=").append(mSystemIcons ? "disabled" : "enabled"); sb.append(" mClock=").append(mClock ? "disabled" : "enabled"); sb.append(" mNotificationIcons=").append(mNotificationIcons ? "disabled" : "enabled"); + sb.append(" mNotificationTicker=").append(mNotificationTicker ? "disabled" : "enabled"); sb.append(" mRotationSuggestion=").append(mRotationSuggestion ? "disabled" : "enabled"); return sb.toString(); @@ -1539,7 +1620,7 @@ public class StatusBarManager { } /** - * Convert a DisableInfo to equivalent flags + * Convert a DisableInfo to equivalent flags. * @return a pair of equivalent disable flags * * @hide @@ -1552,14 +1633,278 @@ public class StatusBarManager { if (mNavigateHome) disable1 |= DISABLE_HOME; if (mNotificationPeeking) disable1 |= DISABLE_NOTIFICATION_ALERTS; if (mRecents) disable1 |= DISABLE_RECENT; + if (mBack) disable1 |= DISABLE_BACK; if (mSearch) disable1 |= DISABLE_SEARCH; if (mSystemIcons) disable1 |= DISABLE_SYSTEM_INFO; if (mClock) disable1 |= DISABLE_CLOCK; if (mNotificationIcons) disable1 |= DISABLE_NOTIFICATION_ICONS; + if (mNotificationTicker) disable1 |= DISABLE_NOTIFICATION_TICKER; if (mRotationSuggestion) disable2 |= DISABLE2_ROTATE_SUGGESTIONS; return new Pair<Integer, Integer>(disable1, disable2); } + + + + // Code below generated by codegen v1.0.23. + // + // DO NOT MODIFY! + // CHECKSTYLE:OFF Generated code + // + // To regenerate run: + // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/app/StatusBarManager.java + // + // To exclude the generated code from IntelliJ auto-formatting enable (one-time): + // Settings > Editor > Code Style > Formatter Control + //@formatter:off + + + /** + * Creates a new DisableInfo. + * @hide + */ + @DataClass.Generated.Member + public DisableInfo( + boolean statusBarExpansion, + boolean navigateHome, + boolean notificationPeeking, + boolean recents, + boolean back, + boolean search, + boolean systemIcons, + boolean clock, + boolean notificationIcons, + boolean rotationSuggestion, + boolean notificationTicker) { + this.mStatusBarExpansion = statusBarExpansion; + this.mNavigateHome = navigateHome; + this.mNotificationPeeking = notificationPeeking; + this.mRecents = recents; + this.mBack = back; + this.mSearch = search; + this.mSystemIcons = systemIcons; + this.mClock = clock; + this.mNotificationIcons = notificationIcons; + this.mRotationSuggestion = rotationSuggestion; + this.mNotificationTicker = notificationTicker; + + // onConstructed(); // You can define this method to get a callback + } + + /** + * @hide + */ + @DataClass.Generated.Member + public boolean isStatusBarExpansion() { + return mStatusBarExpansion; + } + + /** + * @hide + */ + @DataClass.Generated.Member + public boolean isNavigateHome() { + return mNavigateHome; + } + + /** + * @hide + */ + @DataClass.Generated.Member + public boolean isNotificationPeeking() { + return mNotificationPeeking; + } + + /** + * @hide + */ + @DataClass.Generated.Member + public boolean isRecents() { + return mRecents; + } + + /** + * @hide + */ + @DataClass.Generated.Member + public boolean isBack() { + return mBack; + } + + /** + * @hide + */ + @DataClass.Generated.Member + public boolean isSearch() { + return mSearch; + } + + /** + * @hide + */ + @DataClass.Generated.Member + public boolean isSystemIcons() { + return mSystemIcons; + } + + /** + * @hide + */ + @DataClass.Generated.Member + public boolean isClock() { + return mClock; + } + + /** + * @hide + */ + @DataClass.Generated.Member + public boolean isNotificationIcons() { + return mNotificationIcons; + } + + /** + * @hide + */ + @DataClass.Generated.Member + public boolean isRotationSuggestion() { + return mRotationSuggestion; + } + + /** + * @hide + */ + @DataClass.Generated.Member + public boolean isNotificationTicker() { + return mNotificationTicker; + } + + /** + * @hide + */ + @SuppressLint("UnflaggedApi") + @Override + @DataClass.Generated.Member + public void writeToParcel(@NonNull android.os.Parcel dest, int flags) { + // You can override field parcelling by defining methods like: + // void parcelFieldName(Parcel dest, int flags) { ... } + + int flg = 0; + if (mStatusBarExpansion) flg |= 0x1; + if (mNavigateHome) flg |= 0x2; + if (mNotificationPeeking) flg |= 0x4; + if (mRecents) flg |= 0x8; + if (mBack) flg |= 0x10; + if (mSearch) flg |= 0x20; + if (mSystemIcons) flg |= 0x40; + if (mClock) flg |= 0x80; + if (mNotificationIcons) flg |= 0x100; + if (mRotationSuggestion) flg |= 0x200; + if (mNotificationTicker) flg |= 0x400; + dest.writeInt(flg); + } + + /** + * @hide + */ + @SuppressLint("UnflaggedApi") + @Override + @DataClass.Generated.Member + public int describeContents() { return 0; } + + /** @hide */ + @SuppressWarnings({"unchecked", "RedundantCast"}) + @DataClass.Generated.Member + /* package-private */ DisableInfo(@NonNull android.os.Parcel in) { + // You can override field unparcelling by defining methods like: + // static FieldType unparcelFieldName(Parcel in) { ... } + + int flg = in.readInt(); + boolean statusBarExpansion = (flg & 0x1) != 0; + boolean navigateHome = (flg & 0x2) != 0; + boolean notificationPeeking = (flg & 0x4) != 0; + boolean recents = (flg & 0x8) != 0; + boolean back = (flg & 0x10) != 0; + boolean search = (flg & 0x20) != 0; + boolean systemIcons = (flg & 0x40) != 0; + boolean clock = (flg & 0x80) != 0; + boolean notificationIcons = (flg & 0x100) != 0; + boolean rotationSuggestion = (flg & 0x200) != 0; + boolean notificationTicker = (flg & 0x400) != 0; + + this.mStatusBarExpansion = statusBarExpansion; + this.mNavigateHome = navigateHome; + this.mNotificationPeeking = notificationPeeking; + this.mRecents = recents; + this.mBack = back; + this.mSearch = search; + this.mSystemIcons = systemIcons; + this.mClock = clock; + this.mNotificationIcons = notificationIcons; + this.mRotationSuggestion = rotationSuggestion; + this.mNotificationTicker = notificationTicker; + + // onConstructed(); // You can define this method to get a callback + } + + @DataClass.Generated.Member + public static final @NonNull Parcelable.Creator<DisableInfo> CREATOR + = new Parcelable.Creator<DisableInfo>() { + @Override + public DisableInfo[] newArray(int size) { + return new DisableInfo[size]; + } + + @Override + public DisableInfo createFromParcel(@NonNull android.os.Parcel in) { + return new DisableInfo(in); + } + }; + + @DataClass.Generated( + time = 1707345957771L, + codegenVersion = "1.0.23", + sourceFile = "frameworks/base/core/java/android/app/StatusBarManager.java", + inputSignatures = "private boolean mStatusBarExpansion\nprivate " + + "boolean mNavigateHome\nprivate boolean mNotificationPeeking\nprivate " + + "boolean mRecents\nprivate boolean mBack\nprivate boolean " + + "mSearch\nprivate boolean mSystemIcons\nprivate boolean mClock\nprivate" + + " boolean mNotificationIcons\nprivate boolean mRotationSuggestion\n" + + "private boolean mNotificationTicker\npublic " + + "@android.annotation.SystemApi boolean isStatusBarExpansionDisabled()\n" + + "public void setStatusBarExpansionDisabled(boolean)\npublic " + + "@android.annotation.SystemApi boolean isNavigateToHomeDisabled()\n" + + "public void setNavigationHomeDisabled(boolean)\npublic " + + "@android.annotation.SystemApi boolean isNotificationPeekingDisabled()\n" + + "public void setNotificationPeekingDisabled(boolean)\npublic " + + "@android.annotation.SystemApi boolean isRecentsDisabled()\npublic " + + "void setRecentsDisabled(boolean)\npublic @android.annotation.SystemApi " + + "boolean isBackDisabled()\npublic void setBackDisabled(boolean)\npublic " + + "@android.annotation.SystemApi boolean isSearchDisabled()\npublic " + + "void setSearchDisabled(boolean)\npublic boolean " + + "areSystemIconsDisabled()\npublic void setSystemIconsDisabled(boolean)" + + "\npublic boolean isClockDisabled()\npublic " + + "void setClockDisabled(boolean)\npublic " + + "boolean areNotificationIconsDisabled()\npublic " + + "void setNotificationIconsDisabled(boolean)\npublic boolean " + + "isNotificationTickerDisabled()\npublic void " + + "setNotificationTickerDisabled(boolean)\npublic " + + "@android.annotation.TestApi boolean isRotationSuggestionDisabled()\n" + + "public void setRotationSuggestionDisabled(boolean)\npublic " + + "@android.annotation.SystemApi boolean areAllComponentsEnabled()\n" + + "public void setEnableAll()\npublic boolean areAllComponentsDisabled()" + + "\npublic void setDisableAll()\npublic @android.annotation.NonNull " + + "@java.lang.Override java.lang.String toString()\npublic " + + "android.util.Pair<java.lang.Integer,java.lang.Integer> toFlags()\n" + + "class DisableInfo extends java.lang.Object implements " + + "[android.os.Parcelable]\n@com.android.internal.util.DataClass") + @Deprecated + private void __metadata() {} + + + //@formatter:on + // End of generated code + } /** diff --git a/core/java/com/android/internal/statusbar/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl index fc60f065a965..b83b2d20c561 100644 --- a/core/java/com/android/internal/statusbar/IStatusBarService.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBarService.aidl @@ -17,6 +17,7 @@ package com.android.internal.statusbar; import android.app.Notification; +import android.app.StatusBarManager; import android.content.ComponentName; import android.graphics.drawable.Icon; import android.graphics.Rect; @@ -52,9 +53,9 @@ interface IStatusBarService void togglePanel(); @UnsupportedAppUsage void disable(int what, IBinder token, String pkg); - void disableForUser(int what, IBinder token, String pkg, int userId); void disable2(int what, IBinder token, String pkg); - void disable2ForUser(int what, IBinder token, String pkg, int userId); + void disableForUser(in StatusBarManager.DisableInfo info, IBinder token, String pkg, int userId, String reason); + int[] getDisableFlags(IBinder token, int userId); void setIcon(String slot, String iconPackage, int iconId, int iconLevel, String contentDescription); @UnsupportedAppUsage diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DragLayout.java b/libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DragLayout.java index 445ba897c173..619f624ff3bc 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DragLayout.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/draganddrop/DragLayout.java @@ -16,11 +16,11 @@ package com.android.wm.shell.draganddrop; +import static android.app.StatusBarManager.DISABLE2_NONE; import static android.app.StatusBarManager.DISABLE_NONE; import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; import static android.content.pm.ActivityInfo.CONFIG_ASSETS_PATHS; import static android.content.pm.ActivityInfo.CONFIG_UI_MODE; -import static android.content.res.Configuration.ORIENTATION_LANDSCAPE; import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; import static com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_BOTTOM_OR_RIGHT; @@ -445,18 +445,20 @@ public class DragLayout extends LinearLayout { } private void animateFullscreenContainer(boolean visible) { - mStatusBarManager.disable(visible - ? HIDE_STATUS_BAR_FLAGS - : DISABLE_NONE); + int flags = visible ? HIDE_STATUS_BAR_FLAGS : DISABLE_NONE; + StatusBarManager.DisableInfo disableInfo = new StatusBarManager.DisableInfo(flags, + DISABLE2_NONE); + mStatusBarManager.requestDisabledComponent(disableInfo, "animateFullscreenContainer"); // We're only using the first drop zone if there is one fullscreen target mDropZoneView1.setShowingMargin(visible); mDropZoneView1.setShowingHighlight(visible); } private void animateSplitContainers(boolean visible, Runnable animCompleteCallback) { - mStatusBarManager.disable(visible - ? HIDE_STATUS_BAR_FLAGS - : DISABLE_NONE); + int flags = visible ? HIDE_STATUS_BAR_FLAGS : DISABLE_NONE; + StatusBarManager.DisableInfo disableInfo = new StatusBarManager.DisableInfo(flags, + DISABLE2_NONE); + mStatusBarManager.requestDisabledComponent(disableInfo, "animateSplitContainers"); mDropZoneView1.setShowingMargin(visible); mDropZoneView2.setShowingMargin(visible); Animator animator = mDropZoneView1.getAnimator(); diff --git a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialogLite.java b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialogLite.java index 2cff947eb9ab..afcb03da39da 100644 --- a/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialogLite.java +++ b/packages/SystemUI/src/com/android/systemui/globalactions/GlobalActionsDialogLite.java @@ -2689,10 +2689,12 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene protected final void setRotationSuggestionsEnabled(boolean enabled) { try { final int userId = Binder.getCallingUserHandle().getIdentifier(); - final int what = enabled - ? StatusBarManager.DISABLE2_NONE - : StatusBarManager.DISABLE2_ROTATE_SUGGESTIONS; - mStatusBarService.disable2ForUser(what, mToken, mContext.getPackageName(), userId); + StatusBarManager.DisableInfo info = new StatusBarManager.DisableInfo(); + if (enabled) { + info.setRotationSuggestionDisabled(true); + } + mStatusBarService.disableForUser(info, mToken, mContext.getPackageName(), userId, + "setRotationSuggestionsEnabled"); } catch (RemoteException ex) { throw ex.rethrowFromSystemServer(); } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 0ee924dc6829..b5ca79e71c33 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -16,6 +16,7 @@ package com.android.systemui.keyguard; +import static android.app.StatusBarManager.DISABLE2_NONE; import static android.app.StatusBarManager.SESSION_KEYGUARD; import static android.provider.Settings.Secure.LOCK_SCREEN_LOCK_AFTER_TIMEOUT; import static android.provider.Settings.System.LOCKSCREEN_SOUNDS_ENABLED; @@ -3403,9 +3404,12 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, // unless disable is called to show un-hide it once first if (forceClearFlags) { try { - mStatusBarService.disableForUser(flags, mStatusBarDisableToken, + StatusBarManager.DisableInfo info = new StatusBarManager.DisableInfo(flags, + DISABLE2_NONE); + mStatusBarService.disableForUser(info, mStatusBarDisableToken, mContext.getPackageName(), - mSelectedUserInteractor.getSelectedUserId(true)); + mSelectedUserInteractor.getSelectedUserId(true), + "adjustStatusBarLocked - force clear flags"); } catch (RemoteException e) { Log.d(TAG, "Failed to force clear flags", e); } @@ -3431,9 +3435,11 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, } try { - mStatusBarService.disableForUser(flags, mStatusBarDisableToken, - mContext.getPackageName(), - mSelectedUserInteractor.getSelectedUserId(true)); + StatusBarManager.DisableInfo info = new StatusBarManager.DisableInfo(flags, + DISABLE2_NONE); + mStatusBarService.disableForUser(info, mStatusBarDisableToken, + mContext.getPackageName(), mSelectedUserInteractor.getSelectedUserId(true), + "adjustStatusBarLocked - set disable flags"); } catch (RemoteException e) { Log.d(TAG, "Failed to set disable flags: " + flags, e); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java index 4a5411115599..a135802f095e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java @@ -16,7 +16,6 @@ package com.android.systemui.statusbar.phone; -import static android.app.StatusBarManager.DISABLE_HOME; import static android.app.StatusBarManager.WINDOW_STATE_HIDDEN; import static android.app.StatusBarManager.WINDOW_STATE_SHOWING; import static android.app.StatusBarManager.WindowVisibleState; @@ -1006,8 +1005,14 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { // this handling this post-init task. We force an update in this case, and use a new // token to not conflict with any other disabled flags already requested by SysUI Binder token = new Binder(); - mBarService.disable(DISABLE_HOME, token, mContext.getPackageName()); - mBarService.disable(0, token, mContext.getPackageName()); + int userId = mContext.getUserId(); + StatusBarManager.DisableInfo info = new StatusBarManager.DisableInfo(); + info.setNavigationHomeDisabled(true); + mBarService.disableForUser(info, token, mContext.getPackageName(), + userId, "set the initial view visibility"); + + mBarService.disableForUser(new StatusBarManager.DisableInfo(), token, + mContext.getPackageName(), userId, "set the initial view visibility"); } catch (RemoteException ex) { ex.rethrowFromSystemServer(); } diff --git a/services/core/java/com/android/server/UiModeManagerService.java b/services/core/java/com/android/server/UiModeManagerService.java index 82d9377031bc..05010f88efaf 100644 --- a/services/core/java/com/android/server/UiModeManagerService.java +++ b/services/core/java/com/android/server/UiModeManagerService.java @@ -1986,9 +1986,11 @@ final class UiModeManagerService extends SystemService { // the status bar should be totally disabled, the calls below will // have no effect until the device is unlocked. if (mStatusBarManager != null) { - mStatusBarManager.disable(mCarModeEnabled - ? StatusBarManager.DISABLE_NOTIFICATION_TICKER - : StatusBarManager.DISABLE_NONE); + StatusBarManager.DisableInfo info = new StatusBarManager.DisableInfo(); + if (mCarModeEnabled) { + info.setNotificationTickerDisabled(true); + } + mStatusBarManager.requestDisabledComponent(info, "adjustStatusBarCarModeLocked"); } if (mNotificationManager == null) { diff --git a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java index 49553586ccd7..fd316eaf9b96 100644 --- a/services/core/java/com/android/server/statusbar/StatusBarManagerService.java +++ b/services/core/java/com/android/server/statusbar/StatusBarManagerService.java @@ -20,7 +20,9 @@ import static android.Manifest.permission.CONTROL_DEVICE_STATE; import static android.Manifest.permission.INTERACT_ACROSS_USERS; import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL; import static android.app.StatusBarManager.DISABLE2_GLOBAL_ACTIONS; +import static android.app.StatusBarManager.DISABLE2_MASK; import static android.app.StatusBarManager.DISABLE2_NOTIFICATION_SHADE; +import static android.app.StatusBarManager.DISABLE_MASK; import static android.app.StatusBarManager.NAV_BAR_MODE_DEFAULT; import static android.app.StatusBarManager.NAV_BAR_MODE_KIDS; import static android.app.StatusBarManager.NavBarMode; @@ -220,8 +222,9 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D int what1; int what2; IBinder token; + private String mReason; - public DisableRecord(int userId, IBinder token) { + DisableRecord(int userId, IBinder token) { this.userId = userId; this.token = token; try { @@ -234,12 +237,12 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D @Override public void binderDied() { Slog.i(TAG, "binder died for pkg=" + pkg); - disableForUser(0, token, pkg, userId); - disable2ForUser(0, token, pkg, userId); + StatusBarManager.DisableInfo info = new StatusBarManager.DisableInfo(); + disableForUser(info, token, pkg, userId, "Binder Died"); token.unlinkToDeath(this, 0); } - public void setFlags(int what, int which, String pkg) { + public void setFlags(int what, int which, String pkg, String reason) { switch (which) { case 1: what1 = what; @@ -253,6 +256,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D break; } this.pkg = pkg; + this.mReason = reason; } public int getFlags(int which) { @@ -271,8 +275,8 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D @Override public String toString() { - return String.format("userId=%d what1=0x%08X what2=0x%08X pkg=%s token=%s", - userId, what1, what2, pkg, token); + return String.format("userId=%d what1=0x%08X what2=0x%08X pkg=%s token=%s reason=%s", + userId, what1, what2, pkg, token, mReason); } } @@ -1160,57 +1164,59 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D return mTracingEnabled; } - // TODO(b/117478341): make it aware of multi-display if needed. + /** + * @deprecated + * Disable some features in the status bar. + * + * This method is deprecated and callers should use + * {@link #disableForUser(StatusBarManager.DisableInfo, IBinder, String, int, String)} + * + * @hide + */ + @Deprecated @Override public void disable(int what, IBinder token, String pkg) { - disableForUser(what, token, pkg, mCurrentUserId); + StatusBarManager.DisableInfo info = new StatusBarManager.DisableInfo(what & DISABLE_MASK, + what & DISABLE2_MASK); + disableForUser(info, token, pkg, mCurrentUserId, null); } - // TODO(b/117478341): make it aware of multi-display if needed. - @Override - public void disableForUser(int what, IBinder token, String pkg, int userId) { - enforceStatusBar(); - - synchronized (mLock) { - disableLocked(DEFAULT_DISPLAY, userId, what, token, pkg, 1); - } - } - - // TODO(b/117478341): make it aware of multi-display if needed. /** - * Disable additional status bar features. Pass the bitwise-or of the DISABLE2_* flags. - * To re-enable everything, pass {@link #DISABLE2_NONE}. + * @deprecated + * Disable some features in the status bar. + * + * This method is deprecated and callers should use + * {@link #disableForUser(StatusBarManager.DisableInfo, IBinder, String, int, String)} * - * Warning: Only pass DISABLE2_* flags into this function, do not use DISABLE_* flags. + * @hide */ + @Deprecated @Override public void disable2(int what, IBinder token, String pkg) { - disable2ForUser(what, token, pkg, mCurrentUserId); + StatusBarManager.DisableInfo info = new StatusBarManager.DisableInfo(what & DISABLE_MASK, + what & DISABLE2_MASK); + disableForUser(info, token, pkg, mCurrentUserId, null); } // TODO(b/117478341): make it aware of multi-display if needed. - /** - * Disable additional status bar features for a given user. Pass the bitwise-or of the - * DISABLE2_* flags. To re-enable everything, pass {@link #DISABLE_NONE}. - * - * Warning: Only pass DISABLE2_* flags into this function, do not use DISABLE_* flags. - */ @Override - public void disable2ForUser(int what, IBinder token, String pkg, int userId) { + public void disableForUser(StatusBarManager.DisableInfo disableInfo, IBinder token, String pkg, + int userId, String reason) { enforceStatusBar(); - synchronized (mLock) { - disableLocked(DEFAULT_DISPLAY, userId, what, token, pkg, 2); + Pair<Integer, Integer> flags = disableInfo.toFlags(); + disableLocked(DEFAULT_DISPLAY, userId, flags.first, token, pkg, 1, reason); + disableLocked(DEFAULT_DISPLAY, userId, flags.second, token, pkg, 2, reason); } } private void disableLocked(int displayId, int userId, int what, IBinder token, String pkg, - int whichFlag) { + int whichFlag, String reason) { // It's important that the the callback and the call to mBar get done // in the same order when multiple threads are calling this function // so they are paired correctly. The messages on the handler will be // handled in the order they were enqueued, but will be outside the lock. - manageDisableListLocked(userId, what, token, pkg, whichFlag); + manageDisableListLocked(userId, what, token, pkg, whichFlag, reason); // Ensure state for the current user is applied, even if passed a non-current user. final int net1 = gatherDisableActionsLocked(mCurrentUserId, 1); @@ -1359,7 +1365,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D // also allows calls from window manager which is in this process. enforceStatusBarService(); - final int unknownFlags = flags & ~StatusBarManager.DISABLE_MASK; + final int unknownFlags = flags & ~DISABLE_MASK; if (unknownFlags != 0) { Slog.e(TAG, "Unknown disable flags: 0x" + Integer.toHexString(unknownFlags), new RuntimeException()); @@ -1368,7 +1374,8 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D if (SPEW) Slog.d(TAG, "setDisableFlags(0x" + Integer.toHexString(flags) + ")"); synchronized (mLock) { - disableLocked(displayId, mCurrentUserId, flags, mSysUiVisToken, cause, 1); + disableLocked(displayId, mCurrentUserId, flags, mSysUiVisToken, cause, 1, + "setDisableFlags"); } } @@ -2423,7 +2430,8 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D // ================================================================================ // lock on mDisableRecords - void manageDisableListLocked(int userId, int what, IBinder token, String pkg, int which) { + void manageDisableListLocked(int userId, int what, IBinder token, String pkg, int which, + String reason) { if (SPEW) { Slog.d(TAG, "manageDisableList userId=" + userId + " what=0x" + Integer.toHexString(what) + " pkg=" + pkg); @@ -2445,7 +2453,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D // Update existing record if (record != null) { - record.setFlags(what, which, pkg); + record.setFlags(what, which, pkg, reason); if (record.isEmpty()) { mDisableRecords.remove(i); record.token.unlinkToDeath(record, 0); @@ -2455,7 +2463,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D // Record doesn't exist, so we create a new one record = new DisableRecord(userId, token); - record.setFlags(what, which, pkg); + record.setFlags(what, which, pkg, reason); mDisableRecords.add(record); } diff --git a/services/core/java/com/android/server/statusbar/StatusBarShellCommand.java b/services/core/java/com/android/server/statusbar/StatusBarShellCommand.java index d6bf02fcdc47..adb55b41cb48 100644 --- a/services/core/java/com/android/server/statusbar/StatusBarShellCommand.java +++ b/services/core/java/com/android/server/statusbar/StatusBarShellCommand.java @@ -16,8 +16,6 @@ package com.android.server.statusbar; import static android.app.StatusBarManager.DEFAULT_SETUP_DISABLE2_FLAGS; import static android.app.StatusBarManager.DEFAULT_SETUP_DISABLE_FLAGS; -import static android.app.StatusBarManager.DISABLE2_NONE; -import static android.app.StatusBarManager.DISABLE_NONE; import android.app.StatusBarManager.DisableInfo; import android.content.ComponentName; @@ -27,7 +25,6 @@ import android.os.IBinder; import android.os.RemoteException; import android.os.ShellCommand; import android.service.quicksettings.TileService; -import android.util.Pair; import java.io.PrintWriter; @@ -144,25 +141,17 @@ public class StatusBarShellCommand extends ShellCommand { String arg = getNextArgRequired(); String pkg = mContext.getPackageName(); boolean disable = Boolean.parseBoolean(arg); - - if (disable) { - mInterface.disable(DEFAULT_SETUP_DISABLE_FLAGS, sToken, pkg); - mInterface.disable2(DEFAULT_SETUP_DISABLE2_FLAGS, sToken, pkg); - } else { - mInterface.disable(DISABLE_NONE, sToken, pkg); - mInterface.disable2(DISABLE2_NONE, sToken, pkg); - } - + int userId = Binder.getCallingUserHandle().getIdentifier(); + DisableInfo info = disable ? new DisableInfo(DEFAULT_SETUP_DISABLE_FLAGS, + DEFAULT_SETUP_DISABLE2_FLAGS) : new DisableInfo(); + mInterface.disableForUser(info, sToken, pkg, userId, "runDisableForSetup"); return 0; } private int runSendDisableFlag() { String pkg = mContext.getPackageName(); - int disable1 = DISABLE_NONE; - int disable2 = DISABLE2_NONE; - + int userId = Binder.getCallingUserHandle().getIdentifier(); DisableInfo info = new DisableInfo(); - String arg = getNextArg(); while (arg != null) { switch (arg) { @@ -170,7 +159,7 @@ public class StatusBarShellCommand extends ShellCommand { info.setSearchDisabled(true); break; case "home": - info.setNagivationHomeDisabled(true); + info.setNavigationHomeDisabled(true); break; case "recents": info.setRecentsDisabled(true); @@ -197,10 +186,7 @@ public class StatusBarShellCommand extends ShellCommand { arg = getNextArg(); } - Pair<Integer, Integer> flagPair = info.toFlags(); - - mInterface.disable(flagPair.first, sToken, pkg); - mInterface.disable2(flagPair.second, sToken, pkg); + mInterface.disableForUser(info, sToken, pkg, userId, "Shell Commands"); return 0; } diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 0036f498972e..fad68ab4cea4 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -15073,8 +15073,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { if (statusBarService != null) { int flags1 = disabled ? STATUS_BAR_DISABLE_MASK : StatusBarManager.DISABLE_NONE; int flags2 = disabled ? STATUS_BAR_DISABLE2_MASK : StatusBarManager.DISABLE2_NONE; - statusBarService.disableForUser(flags1, mToken, mContext.getPackageName(), userId); - statusBarService.disable2ForUser(flags2, mToken, mContext.getPackageName(), userId); + StatusBarManager.DisableInfo info = new StatusBarManager.DisableInfo(flags1, + flags2); + statusBarService.disableForUser(info, mToken, mContext.getPackageName(), userId, + "setStatusBarDisabledInternal"); return true; } } catch (RemoteException e) { diff --git a/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java b/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java index 6bcfebc752f1..3ab8d370750f 100644 --- a/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java +++ b/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java @@ -176,19 +176,25 @@ public class StatusBarTest extends TestActivity }, new Test("Disable Alerts") { public void run() { - mStatusBarManager.disable(StatusBarManager.DISABLE_NOTIFICATION_ALERTS); + StatusBarManager.DisableInfo info = new StatusBarManager.DisableInfo(); + info.setNotificationPeekingDisabled(true); + mStatusBarManager.requestDisabledComponent(info, "test"); } }, new Test("Disable Ticker") { public void run() { - mStatusBarManager.disable(StatusBarManager.DISABLE_NOTIFICATION_TICKER); + StatusBarManager.DisableInfo info = new StatusBarManager.DisableInfo(); + info.setNotificationTickerDisabled(true); + mStatusBarManager.requestDisabledComponent(info, "test"); } }, new Test("Disable Expand in 3 sec.") { public void run() { mHandler.postDelayed(new Runnable() { public void run() { - mStatusBarManager.disable(StatusBarManager.DISABLE_EXPAND); + StatusBarManager.DisableInfo info = new StatusBarManager.DisableInfo(); + info.setStatusBarExpansionDisabled(true); + mStatusBarManager.requestDisabledComponent(info, "test"); } }, 3000); } @@ -197,7 +203,9 @@ public class StatusBarTest extends TestActivity public void run() { mHandler.postDelayed(new Runnable() { public void run() { - mStatusBarManager.disable(StatusBarManager.DISABLE_NOTIFICATION_ICONS); + StatusBarManager.DisableInfo info = new StatusBarManager.DisableInfo(); + info.setNotificationIconsDisabled(true); + mStatusBarManager.requestDisabledComponent(info, "test"); } }, 3000); } @@ -206,56 +214,73 @@ public class StatusBarTest extends TestActivity public void run() { mHandler.postDelayed(new Runnable() { public void run() { - mStatusBarManager.disable(StatusBarManager.DISABLE_EXPAND - | StatusBarManager.DISABLE_NOTIFICATION_ICONS); + StatusBarManager.DisableInfo info = new StatusBarManager.DisableInfo(); + info.setStatusBarExpansionDisabled(true); + info.setNotificationIconsDisabled(true); + mStatusBarManager.requestDisabledComponent(info, "test"); } }, 3000); } }, new Test("Disable Home (StatusBarManager)") { public void run() { - mStatusBarManager.disable(StatusBarManager.DISABLE_HOME); + StatusBarManager.DisableInfo info = new StatusBarManager.DisableInfo(); + info.setNavigationHomeDisabled(true); + mStatusBarManager.requestDisabledComponent(info, "test"); } }, new Test("Disable Back (StatusBarManager)") { public void run() { - mStatusBarManager.disable(StatusBarManager.DISABLE_BACK); + StatusBarManager.DisableInfo info = new StatusBarManager.DisableInfo(); + info.setBackDisabled(true); + mStatusBarManager.requestDisabledComponent(info, "test"); } }, new Test("Disable Recent (StatusBarManager)") { public void run() { - mStatusBarManager.disable(StatusBarManager.DISABLE_RECENT); + StatusBarManager.DisableInfo info = new StatusBarManager.DisableInfo(); + info.setRecentsDisabled(true); + mStatusBarManager.requestDisabledComponent(info, "test"); } }, new Test("Disable Clock") { public void run() { - mStatusBarManager.disable(StatusBarManager.DISABLE_CLOCK); + StatusBarManager.DisableInfo info = new StatusBarManager.DisableInfo(); + info.setClockDisabled(true); + mStatusBarManager.requestDisabledComponent(info, "test"); } }, new Test("Disable System Info") { public void run() { - mStatusBarManager.disable(StatusBarManager.DISABLE_SYSTEM_INFO); + StatusBarManager.DisableInfo info = new StatusBarManager.DisableInfo(); + info.setSystemIconsDisabled(true); + mStatusBarManager.requestDisabledComponent(info, "test"); } }, new Test("Disable everything in 3 sec") { public void run() { mHandler.postDelayed(new Runnable() { public void run() { - mStatusBarManager.disable(~StatusBarManager.DISABLE_NONE); + StatusBarManager.DisableInfo info = new StatusBarManager.DisableInfo(); + info.setDisableAll(); + mStatusBarManager.requestDisabledComponent(info, "test"); } }, 3000); } }, new Test("Enable everything") { public void run() { - mStatusBarManager.disable(StatusBarManager.DISABLE_NONE); + StatusBarManager.DisableInfo info = new StatusBarManager.DisableInfo(); + mStatusBarManager.requestDisabledComponent(info, "test"); } }, new Test("Enable everything in 3 sec.") { public void run() { mHandler.postDelayed(new Runnable() { public void run() { - mStatusBarManager.disable(0); + StatusBarManager.DisableInfo info = new StatusBarManager.DisableInfo(); + info.setEnableAll(); + mStatusBarManager.requestDisabledComponent(info, "test"); } }, 3000); } |