am 0c2d0deb: Merge "Introduce disable2 into StatusBarManager" into mnc-dev
* commit '0c2d0deb3666c7bb9c315212f5caec1bc1945611': Introduce disable2 into StatusBarManager
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
|
||||
package android.app;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.content.Context;
|
||||
import android.os.Binder;
|
||||
import android.os.RemoteException;
|
||||
@@ -27,6 +28,9 @@ import android.view.View;
|
||||
|
||||
import com.android.internal.statusbar.IStatusBarService;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* Allows an app to control the status bar.
|
||||
*
|
||||
@@ -59,6 +63,15 @@ public class StatusBarManager {
|
||||
| DISABLE_SYSTEM_INFO | DISABLE_RECENT | DISABLE_HOME | DISABLE_BACK | DISABLE_CLOCK
|
||||
| DISABLE_SEARCH;
|
||||
|
||||
public static final int DISABLE2_NONE = 0x00000000;
|
||||
|
||||
public static final int DISABLE2_MASK = 0x00000000;
|
||||
|
||||
@IntDef(flag = true,
|
||||
value = {DISABLE2_NONE, DISABLE2_MASK})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface Disable2Flags {}
|
||||
|
||||
public static final int NAVIGATION_HINT_BACK_ALT = 1 << 0;
|
||||
public static final int NAVIGATION_HINT_IME_SHOWN = 1 << 1;
|
||||
|
||||
@@ -103,7 +116,25 @@ public class StatusBarManager {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Disable additional status bar features. 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.
|
||||
*/
|
||||
public void disable2(@Disable2Flags int what) {
|
||||
try {
|
||||
final IStatusBarService svc = getService();
|
||||
if (svc != null) {
|
||||
svc.disable2(what, mToken, mContext.getPackageName());
|
||||
}
|
||||
} catch (RemoteException ex) {
|
||||
// system process is dead anyway.
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Expand the notifications panel.
|
||||
*/
|
||||
|
||||
@@ -24,7 +24,7 @@ oneway interface IStatusBar
|
||||
{
|
||||
void setIcon(int index, in StatusBarIcon icon);
|
||||
void removeIcon(int index);
|
||||
void disable(int state);
|
||||
void disable(int state1, int state2);
|
||||
void animateExpandNotificationsPanel();
|
||||
void animateExpandSettingsPanel();
|
||||
void animateCollapsePanels();
|
||||
|
||||
@@ -28,6 +28,8 @@ interface IStatusBarService
|
||||
void collapsePanels();
|
||||
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 setIcon(String slot, String iconPackage, int iconId, int iconLevel, String contentDescription);
|
||||
void setIconVisibility(String slot, boolean visible);
|
||||
void removeIcon(String slot);
|
||||
|
||||
@@ -5,7 +5,7 @@ option java_package com.android.systemui;
|
||||
# ---------------------------
|
||||
# PhoneStatusBar.java
|
||||
# ---------------------------
|
||||
36000 sysui_statusbar_touch (type|1),(x|1),(y|1),(enabled|1)
|
||||
36000 sysui_statusbar_touch (type|1),(x|1),(y|1),(disable1|1),(disable2|1)
|
||||
36001 sysui_heads_up_status (key|3),(visible|1)
|
||||
36002 sysui_fullscreen_notification (key|3)
|
||||
36003 sysui_heads_up_escalation (key|3)
|
||||
|
||||
@@ -581,7 +581,7 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
createAndAddWindows();
|
||||
|
||||
mSettingsObserver.onChange(false); // set up
|
||||
disable(switches[0], false /* animate */);
|
||||
disable(switches[0], switches[6], false /* animate */);
|
||||
setSystemUiVisibility(switches[1], 0xffffffff);
|
||||
topAppWindowChanged(switches[2] != 0);
|
||||
// StatusBarManagerService has a back up of IME token and it's restored here.
|
||||
|
||||
@@ -83,7 +83,7 @@ public class CommandQueue extends IStatusBar.Stub {
|
||||
public void updateIcon(String slot, int index, int viewIndex,
|
||||
StatusBarIcon old, StatusBarIcon icon);
|
||||
public void removeIcon(String slot, int index, int viewIndex);
|
||||
public void disable(int state, boolean animate);
|
||||
public void disable(int state1, int state2, boolean animate);
|
||||
public void animateExpandNotificationsPanel();
|
||||
public void animateCollapsePanels(int flags);
|
||||
public void animateExpandSettingsPanel();
|
||||
@@ -127,10 +127,10 @@ public class CommandQueue extends IStatusBar.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
public void disable(int state) {
|
||||
public void disable(int state1, int state2) {
|
||||
synchronized (mList) {
|
||||
mHandler.removeMessages(MSG_DISABLE);
|
||||
mHandler.obtainMessage(MSG_DISABLE, state, 0, null).sendToTarget();
|
||||
mHandler.obtainMessage(MSG_DISABLE, state1, state2, null).sendToTarget();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,7 +304,7 @@ public class CommandQueue extends IStatusBar.Stub {
|
||||
break;
|
||||
}
|
||||
case MSG_DISABLE:
|
||||
mCallbacks.disable(msg.arg1, true /* animate */);
|
||||
mCallbacks.disable(msg.arg1, msg.arg2, true /* animate */);
|
||||
break;
|
||||
case MSG_EXPAND_NOTIFICATIONS:
|
||||
mCallbacks.animateExpandNotificationsPanel();
|
||||
|
||||
@@ -305,7 +305,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
ArrayList<Runnable> mPostCollapseRunnables = new ArrayList<>();
|
||||
|
||||
// for disabling the status bar
|
||||
int mDisabled = 0;
|
||||
int mDisabled1 = 0;
|
||||
int mDisabled2 = 0;
|
||||
|
||||
// tracking calls to View.setSystemUiVisibility()
|
||||
int mSystemUiVisibility = View.SYSTEM_UI_FLAG_VISIBLE;
|
||||
@@ -427,7 +428,8 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
}
|
||||
};
|
||||
|
||||
private int mDisabledUnmodified;
|
||||
private int mDisabledUnmodified1;
|
||||
private int mDisabledUnmodified2;
|
||||
|
||||
/** Keys of notifications currently visible to the user. */
|
||||
private final ArraySet<String> mCurrentlyVisibleNotifications = new ArraySet<String>();
|
||||
@@ -637,7 +639,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
mNavigationBarView =
|
||||
(NavigationBarView) View.inflate(context, R.layout.navigation_bar, null);
|
||||
|
||||
mNavigationBarView.setDisabledFlags(mDisabled);
|
||||
mNavigationBarView.setDisabledFlags(mDisabled1);
|
||||
mNavigationBarView.setBar(this);
|
||||
mNavigationBarView.setOnVerticalChangedListener(
|
||||
new NavigationBarView.OnVerticalChangedListener() {
|
||||
@@ -1691,84 +1693,91 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
/**
|
||||
* State is one or more of the DISABLE constants from StatusBarManager.
|
||||
*/
|
||||
public void disable(int state, boolean animate) {
|
||||
mDisabledUnmodified = state;
|
||||
state = adjustDisableFlags(state);
|
||||
final int old = mDisabled;
|
||||
final int diff = state ^ old;
|
||||
mDisabled = state;
|
||||
public void disable(int state1, int state2, boolean animate) {
|
||||
mDisabledUnmodified1 = state1;
|
||||
mDisabledUnmodified2 = state2;
|
||||
state1 = adjustDisableFlags(state1);
|
||||
final int old1 = mDisabled1;
|
||||
final int diff1 = state1 ^ old1;
|
||||
mDisabled1 = state1;
|
||||
|
||||
final int old2 = mDisabled2;
|
||||
final int diff2 = state2 ^ old2;
|
||||
mDisabled2 = state2;
|
||||
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, String.format("disable: 0x%08x -> 0x%08x (diff: 0x%08x)",
|
||||
old, state, diff));
|
||||
Log.d(TAG, String.format("disable1: 0x%08x -> 0x%08x (diff1: 0x%08x)",
|
||||
old1, state1, diff1));
|
||||
Log.d(TAG, String.format("disable2: 0x%08x -> 0x%08x (diff2: 0x%08x)",
|
||||
old2, state2, diff2));
|
||||
}
|
||||
|
||||
StringBuilder flagdbg = new StringBuilder();
|
||||
flagdbg.append("disable: < ");
|
||||
flagdbg.append(((state & StatusBarManager.DISABLE_EXPAND) != 0) ? "EXPAND" : "expand");
|
||||
flagdbg.append(((diff & StatusBarManager.DISABLE_EXPAND) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) ? "ICONS" : "icons");
|
||||
flagdbg.append(((diff & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state & StatusBarManager.DISABLE_NOTIFICATION_ALERTS) != 0) ? "ALERTS" : "alerts");
|
||||
flagdbg.append(((diff & StatusBarManager.DISABLE_NOTIFICATION_ALERTS) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state & StatusBarManager.DISABLE_SYSTEM_INFO) != 0) ? "SYSTEM_INFO" : "system_info");
|
||||
flagdbg.append(((diff & StatusBarManager.DISABLE_SYSTEM_INFO) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state & StatusBarManager.DISABLE_BACK) != 0) ? "BACK" : "back");
|
||||
flagdbg.append(((diff & StatusBarManager.DISABLE_BACK) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state & StatusBarManager.DISABLE_HOME) != 0) ? "HOME" : "home");
|
||||
flagdbg.append(((diff & StatusBarManager.DISABLE_HOME) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state & StatusBarManager.DISABLE_RECENT) != 0) ? "RECENT" : "recent");
|
||||
flagdbg.append(((diff & StatusBarManager.DISABLE_RECENT) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state & StatusBarManager.DISABLE_CLOCK) != 0) ? "CLOCK" : "clock");
|
||||
flagdbg.append(((diff & StatusBarManager.DISABLE_CLOCK) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state & StatusBarManager.DISABLE_SEARCH) != 0) ? "SEARCH" : "search");
|
||||
flagdbg.append(((diff & StatusBarManager.DISABLE_SEARCH) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state1 & StatusBarManager.DISABLE_EXPAND) != 0) ? "EXPAND" : "expand");
|
||||
flagdbg.append(((diff1 & StatusBarManager.DISABLE_EXPAND) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state1 & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) ? "ICONS" : "icons");
|
||||
flagdbg.append(((diff1 & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state1 & StatusBarManager.DISABLE_NOTIFICATION_ALERTS) != 0) ? "ALERTS" : "alerts");
|
||||
flagdbg.append(((diff1 & StatusBarManager.DISABLE_NOTIFICATION_ALERTS) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state1 & StatusBarManager.DISABLE_SYSTEM_INFO) != 0) ? "SYSTEM_INFO" : "system_info");
|
||||
flagdbg.append(((diff1 & StatusBarManager.DISABLE_SYSTEM_INFO) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state1 & StatusBarManager.DISABLE_BACK) != 0) ? "BACK" : "back");
|
||||
flagdbg.append(((diff1 & StatusBarManager.DISABLE_BACK) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state1 & StatusBarManager.DISABLE_HOME) != 0) ? "HOME" : "home");
|
||||
flagdbg.append(((diff1 & StatusBarManager.DISABLE_HOME) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state1 & StatusBarManager.DISABLE_RECENT) != 0) ? "RECENT" : "recent");
|
||||
flagdbg.append(((diff1 & StatusBarManager.DISABLE_RECENT) != 0) ? "* " : " ");
|
||||
flagdbg.append(((state1 & StatusBarManager.DISABLE_CLOCK) != 0) ? "CLOCK" : "clock");
|
||||
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(">");
|
||||
Log.d(TAG, flagdbg.toString());
|
||||
|
||||
if ((diff & StatusBarManager.DISABLE_SYSTEM_INFO) != 0) {
|
||||
if ((state & StatusBarManager.DISABLE_SYSTEM_INFO) != 0) {
|
||||
if ((diff1 & StatusBarManager.DISABLE_SYSTEM_INFO) != 0) {
|
||||
if ((state1 & StatusBarManager.DISABLE_SYSTEM_INFO) != 0) {
|
||||
mIconController.hideSystemIconArea(animate);
|
||||
} else {
|
||||
mIconController.showSystemIconArea(animate);
|
||||
}
|
||||
}
|
||||
|
||||
if ((diff & StatusBarManager.DISABLE_CLOCK) != 0) {
|
||||
boolean visible = (state & StatusBarManager.DISABLE_CLOCK) == 0;
|
||||
if ((diff1 & StatusBarManager.DISABLE_CLOCK) != 0) {
|
||||
boolean visible = (state1 & StatusBarManager.DISABLE_CLOCK) == 0;
|
||||
mIconController.setClockVisibility(visible);
|
||||
}
|
||||
if ((diff & StatusBarManager.DISABLE_EXPAND) != 0) {
|
||||
if ((state & StatusBarManager.DISABLE_EXPAND) != 0) {
|
||||
if ((diff1 & StatusBarManager.DISABLE_EXPAND) != 0) {
|
||||
if ((state1 & StatusBarManager.DISABLE_EXPAND) != 0) {
|
||||
animateCollapsePanels();
|
||||
}
|
||||
}
|
||||
|
||||
if ((diff & (StatusBarManager.DISABLE_HOME
|
||||
if ((diff1 & (StatusBarManager.DISABLE_HOME
|
||||
| StatusBarManager.DISABLE_RECENT
|
||||
| StatusBarManager.DISABLE_BACK
|
||||
| StatusBarManager.DISABLE_SEARCH)) != 0) {
|
||||
// the nav bar will take care of these
|
||||
if (mNavigationBarView != null) mNavigationBarView.setDisabledFlags(state);
|
||||
if (mNavigationBarView != null) mNavigationBarView.setDisabledFlags(state1);
|
||||
|
||||
if ((state & StatusBarManager.DISABLE_RECENT) != 0) {
|
||||
if ((state1 & StatusBarManager.DISABLE_RECENT) != 0) {
|
||||
// close recents if it's visible
|
||||
mHandler.removeMessages(MSG_HIDE_RECENT_APPS);
|
||||
mHandler.sendEmptyMessage(MSG_HIDE_RECENT_APPS);
|
||||
}
|
||||
}
|
||||
|
||||
if ((diff & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) {
|
||||
if ((state & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) {
|
||||
if ((diff1 & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) {
|
||||
if ((state1 & StatusBarManager.DISABLE_NOTIFICATION_ICONS) != 0) {
|
||||
mIconController.hideNotificationIconArea(animate);
|
||||
} else {
|
||||
mIconController.showNotificationIconArea(animate);
|
||||
}
|
||||
}
|
||||
|
||||
if ((diff & StatusBarManager.DISABLE_NOTIFICATION_ALERTS) != 0) {
|
||||
if ((diff1 & StatusBarManager.DISABLE_NOTIFICATION_ALERTS) != 0) {
|
||||
mDisableNotificationAlerts =
|
||||
(state & StatusBarManager.DISABLE_NOTIFICATION_ALERTS) != 0;
|
||||
(state1 & StatusBarManager.DISABLE_NOTIFICATION_ALERTS) != 0;
|
||||
mHeadsUpObserver.onChange(true);
|
||||
}
|
||||
}
|
||||
@@ -1941,7 +1950,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
}
|
||||
|
||||
boolean panelsEnabled() {
|
||||
return (mDisabled & StatusBarManager.DISABLE_EXPAND) == 0;
|
||||
return (mDisabled1 & StatusBarManager.DISABLE_EXPAND) == 0;
|
||||
}
|
||||
|
||||
void makeExpandedVisible(boolean force) {
|
||||
@@ -1961,7 +1970,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
|
||||
visibilityChanged(true);
|
||||
mWaitingForKeyguardExit = false;
|
||||
disable(mDisabledUnmodified, !force /* animate */);
|
||||
disable(mDisabledUnmodified1, mDisabledUnmodified2, !force /* animate */);
|
||||
setInteracting(StatusBarManager.WINDOW_STATUS_BAR, true);
|
||||
}
|
||||
|
||||
@@ -2094,7 +2103,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
runPostCollapseRunnables();
|
||||
setInteracting(StatusBarManager.WINDOW_STATUS_BAR, false);
|
||||
showBouncer();
|
||||
disable(mDisabledUnmodified, true /* animate */);
|
||||
disable(mDisabledUnmodified1, mDisabledUnmodified2, true /* animate */);
|
||||
|
||||
// Trimming will happen later if Keyguard is showing - doing it here might cause a jank in
|
||||
// the bouncer appear animation.
|
||||
@@ -2107,20 +2116,21 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
if (DEBUG_GESTURES) {
|
||||
if (event.getActionMasked() != MotionEvent.ACTION_MOVE) {
|
||||
EventLog.writeEvent(EventLogTags.SYSUI_STATUSBAR_TOUCH,
|
||||
event.getActionMasked(), (int) event.getX(), (int) event.getY(), mDisabled);
|
||||
event.getActionMasked(), (int) event.getX(), (int) event.getY(),
|
||||
mDisabled1, mDisabled2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (SPEW) {
|
||||
Log.d(TAG, "Touch: rawY=" + event.getRawY() + " event=" + event + " mDisabled="
|
||||
+ mDisabled + " mTracking=" + mTracking);
|
||||
Log.d(TAG, "Touch: rawY=" + event.getRawY() + " event=" + event + " mDisabled1="
|
||||
+ mDisabled1 + " mDisabled2=" + mDisabled2 + " mTracking=" + mTracking);
|
||||
} else if (CHATTY) {
|
||||
if (event.getAction() != MotionEvent.ACTION_MOVE) {
|
||||
Log.d(TAG, String.format(
|
||||
"panel: %s at (%f, %f) mDisabled=0x%08x",
|
||||
"panel: %s at (%f, %f) mDisabled1=0x%08x mDisabled2=0x%08x",
|
||||
MotionEvent.actionToString(event.getAction()),
|
||||
event.getRawX(), event.getRawY(), mDisabled));
|
||||
event.getRawX(), event.getRawY(), mDisabled1, mDisabled2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2921,7 +2931,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
public boolean shouldDisableNavbarGestures() {
|
||||
return !isDeviceProvisioned()
|
||||
|| mExpandedVisible
|
||||
|| (mDisabled & StatusBarManager.DISABLE_SEARCH) != 0;
|
||||
|| (mDisabled1 & StatusBarManager.DISABLE_SEARCH) != 0;
|
||||
}
|
||||
|
||||
public void postStartSettingsActivity(final Intent intent, int delay) {
|
||||
@@ -3235,7 +3245,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
startTime + fadeoutDuration
|
||||
- StatusBarIconController.DEFAULT_TINT_ANIMATION_DURATION,
|
||||
StatusBarIconController.DEFAULT_TINT_ANIMATION_DURATION);
|
||||
disable(mDisabledUnmodified, true /* animate */);
|
||||
disable(mDisabledUnmodified1, mDisabledUnmodified2, true /* animate */);
|
||||
}
|
||||
|
||||
public boolean isKeyguardFadingAway() {
|
||||
@@ -3547,7 +3557,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
@Override
|
||||
public void setBouncerShowing(boolean bouncerShowing) {
|
||||
super.setBouncerShowing(bouncerShowing);
|
||||
disable(mDisabledUnmodified, true /* animate */);
|
||||
disable(mDisabledUnmodified1, mDisabledUnmodified2, true /* animate */);
|
||||
}
|
||||
|
||||
public void onScreenTurnedOff() {
|
||||
@@ -3591,7 +3601,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
if ((time - mLastLockToAppLongPress) < LOCK_TO_APP_GESTURE_TOLERENCE) {
|
||||
activityManager.stopLockTaskModeOnCurrent();
|
||||
// When exiting refresh disabled flags.
|
||||
mNavigationBarView.setDisabledFlags(mDisabled, true);
|
||||
mNavigationBarView.setDisabledFlags(mDisabled1, true);
|
||||
} else if ((v.getId() == R.id.back)
|
||||
&& !mNavigationBarView.getRecentsButton().isPressed()) {
|
||||
// If we aren't pressing recents right now then they presses
|
||||
@@ -3608,7 +3618,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
||||
// should stop lock task.
|
||||
activityManager.stopLockTaskModeOnCurrent();
|
||||
// When exiting refresh disabled flags.
|
||||
mNavigationBarView.setDisabledFlags(mDisabled, true);
|
||||
mNavigationBarView.setDisabledFlags(mDisabled1, true);
|
||||
}
|
||||
}
|
||||
if (sendBackLongPress) {
|
||||
|
||||
@@ -59,7 +59,7 @@ public class TvStatusBar extends BaseStatusBar {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disable(int state, boolean animate) {
|
||||
public void disable(int state1, int state2, boolean animate) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -59,7 +59,8 @@ public class StatusBarManagerService extends IStatusBarService.Stub {
|
||||
// for disabling the status bar
|
||||
private final ArrayList<DisableRecord> mDisableRecords = new ArrayList<DisableRecord>();
|
||||
private IBinder mSysUiVisToken = new Binder();
|
||||
private int mDisabled = 0;
|
||||
private int mDisabled1 = 0;
|
||||
private int mDisabled2 = 0;
|
||||
|
||||
private Object mLock = new Object();
|
||||
// encompasses lights-out mode and other flags defined on View
|
||||
@@ -74,12 +75,14 @@ public class StatusBarManagerService extends IStatusBarService.Stub {
|
||||
private class DisableRecord implements IBinder.DeathRecipient {
|
||||
int userId;
|
||||
String pkg;
|
||||
int what;
|
||||
int what1;
|
||||
int what2;
|
||||
IBinder token;
|
||||
|
||||
public void binderDied() {
|
||||
Slog.i(TAG, "binder died for pkg=" + pkg);
|
||||
disableForUser(0, token, pkg, userId);
|
||||
disable2ForUser(0, token, pkg, userId);
|
||||
token.unlinkToDeath(this, 0);
|
||||
}
|
||||
}
|
||||
@@ -202,29 +205,57 @@ public class StatusBarManagerService extends IStatusBarService.Stub {
|
||||
enforceStatusBar();
|
||||
|
||||
synchronized (mLock) {
|
||||
disableLocked(userId, what, token, pkg);
|
||||
disableLocked(userId, what, token, pkg, 1);
|
||||
}
|
||||
}
|
||||
|
||||
private void disableLocked(int userId, int what, IBinder token, String pkg) {
|
||||
/**
|
||||
* Disable additional status bar features. 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 disable2(int what, IBinder token, String pkg) {
|
||||
disableForUser(what, token, pkg, mCurrentUserId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
enforceStatusBar();
|
||||
|
||||
synchronized (mLock) {
|
||||
disableLocked(userId, what, token, pkg, 2);
|
||||
}
|
||||
}
|
||||
|
||||
private void disableLocked(int userId, int what, IBinder token, String pkg, int whichFlag) {
|
||||
// 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);
|
||||
manageDisableListLocked(userId, what, token, pkg, whichFlag);
|
||||
|
||||
// Ensure state for the current user is applied, even if passed a non-current user.
|
||||
final int net = gatherDisableActionsLocked(mCurrentUserId);
|
||||
if (net != mDisabled) {
|
||||
mDisabled = net;
|
||||
final int net1 = gatherDisableActionsLocked(mCurrentUserId, 1);
|
||||
final int net2 = gatherDisableActionsLocked(mCurrentUserId, 2);
|
||||
if (net1 != mDisabled1 || net2 != mDisabled2) {
|
||||
mDisabled1 = net1;
|
||||
mDisabled2 = net2;
|
||||
mHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
mNotificationDelegate.onSetDisabled(net);
|
||||
mNotificationDelegate.onSetDisabled(net1);
|
||||
}
|
||||
});
|
||||
if (mBar != null) {
|
||||
try {
|
||||
mBar.disable(net);
|
||||
mBar.disable(net1, net2);
|
||||
} catch (RemoteException ex) {
|
||||
}
|
||||
}
|
||||
@@ -375,7 +406,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub {
|
||||
mCurrentUserId,
|
||||
vis & StatusBarManager.DISABLE_MASK,
|
||||
mSysUiVisToken,
|
||||
cause);
|
||||
cause, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -513,12 +544,13 @@ public class StatusBarManagerService extends IStatusBarService.Stub {
|
||||
iconList.copyFrom(mIcons);
|
||||
}
|
||||
synchronized (mLock) {
|
||||
switches[0] = gatherDisableActionsLocked(mCurrentUserId);
|
||||
switches[0] = gatherDisableActionsLocked(mCurrentUserId, 1);
|
||||
switches[1] = mSystemUiVisibility;
|
||||
switches[2] = mMenuVisible ? 1 : 0;
|
||||
switches[3] = mImeWindowVis;
|
||||
switches[4] = mImeBackDisposition;
|
||||
switches[5] = mShowImeSwitcher ? 1 : 0;
|
||||
switches[6] = gatherDisableActionsLocked(mCurrentUserId, 2);
|
||||
binders.add(mImeToken);
|
||||
}
|
||||
}
|
||||
@@ -660,7 +692,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub {
|
||||
// ================================================================================
|
||||
|
||||
// lock on mDisableRecords
|
||||
void manageDisableListLocked(int userId, int what, IBinder token, String pkg) {
|
||||
void manageDisableListLocked(int userId, int what, IBinder token, String pkg, int which) {
|
||||
if (SPEW) {
|
||||
Slog.d(TAG, "manageDisableList userId=" + userId
|
||||
+ " what=0x" + Integer.toHexString(what) + " pkg=" + pkg);
|
||||
@@ -693,21 +725,25 @@ public class StatusBarManagerService extends IStatusBarService.Stub {
|
||||
}
|
||||
mDisableRecords.add(tok);
|
||||
}
|
||||
tok.what = what;
|
||||
if (which == 1) {
|
||||
tok.what1 = what;
|
||||
} else {
|
||||
tok.what2 = what;
|
||||
}
|
||||
tok.token = token;
|
||||
tok.pkg = pkg;
|
||||
}
|
||||
}
|
||||
|
||||
// lock on mDisableRecords
|
||||
int gatherDisableActionsLocked(int userId) {
|
||||
int gatherDisableActionsLocked(int userId, int which) {
|
||||
final int N = mDisableRecords.size();
|
||||
// gather the new net flags
|
||||
int net = 0;
|
||||
for (int i=0; i<N; i++) {
|
||||
final DisableRecord rec = mDisableRecords.get(i);
|
||||
if (rec.userId == userId) {
|
||||
net |= rec.what;
|
||||
net |= (which == 1) ? rec.what1 : rec.what2;
|
||||
}
|
||||
}
|
||||
return net;
|
||||
@@ -731,13 +767,15 @@ public class StatusBarManagerService extends IStatusBarService.Stub {
|
||||
}
|
||||
|
||||
synchronized (mLock) {
|
||||
pw.println(" mDisabled=0x" + Integer.toHexString(mDisabled));
|
||||
pw.println(" mDisabled1=0x" + Integer.toHexString(mDisabled1));
|
||||
pw.println(" mDisabled2=0x" + Integer.toHexString(mDisabled2));
|
||||
final int N = mDisableRecords.size();
|
||||
pw.println(" mDisableRecords.size=" + N);
|
||||
for (int i=0; i<N; i++) {
|
||||
DisableRecord tok = mDisableRecords.get(i);
|
||||
pw.println(" [" + i + "] userId=" + tok.userId
|
||||
+ " what=0x" + Integer.toHexString(tok.what)
|
||||
+ " what1=0x" + Integer.toHexString(tok.what1)
|
||||
+ " what2=0x" + Integer.toHexString(tok.what2)
|
||||
+ " pkg=" + tok.pkg
|
||||
+ " token=" + tok.token);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user