* commit 'db3b01a5bfbf5e190bf6116b71e27971c3b5816b': Status bar: Keep disabled state per user.
This commit is contained in:
@@ -33,6 +33,7 @@ interface IStatusBarService
|
|||||||
void topAppWindowChanged(boolean menuVisible);
|
void topAppWindowChanged(boolean menuVisible);
|
||||||
void setImeWindowStatus(in IBinder token, int vis, int backDisposition);
|
void setImeWindowStatus(in IBinder token, int vis, int backDisposition);
|
||||||
void expandSettingsPanel();
|
void expandSettingsPanel();
|
||||||
|
void setCurrentUser(int newUserId);
|
||||||
|
|
||||||
// ---- Methods below are for use by the status bar policy services ----
|
// ---- Methods below are for use by the status bar policy services ----
|
||||||
// You need the STATUS_BAR_SERVICE permission
|
// You need the STATUS_BAR_SERVICE permission
|
||||||
|
|||||||
@@ -4298,6 +4298,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
if (mKeyguardMediator != null) {
|
if (mKeyguardMediator != null) {
|
||||||
mKeyguardMediator.setCurrentUser(newUserId);
|
mKeyguardMediator.setCurrentUser(newUserId);
|
||||||
}
|
}
|
||||||
|
if (mStatusBarService != null) {
|
||||||
|
try {
|
||||||
|
mStatusBarService.setCurrentUser(newUserId);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
// oh well
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
|||||||
= new HashMap<IBinder,StatusBarNotification>();
|
= new HashMap<IBinder,StatusBarNotification>();
|
||||||
|
|
||||||
// for disabling the status bar
|
// for disabling the status bar
|
||||||
ArrayList<DisableRecord> mDisableRecords = new ArrayList<DisableRecord>();
|
final ArrayList<DisableRecord> mDisableRecords = new ArrayList<DisableRecord>();
|
||||||
IBinder mSysUiVisToken = new Binder();
|
IBinder mSysUiVisToken = new Binder();
|
||||||
int mDisabled = 0;
|
int mDisabled = 0;
|
||||||
|
|
||||||
@@ -75,15 +75,17 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
|||||||
int mImeWindowVis = 0;
|
int mImeWindowVis = 0;
|
||||||
int mImeBackDisposition;
|
int mImeBackDisposition;
|
||||||
IBinder mImeToken = null;
|
IBinder mImeToken = null;
|
||||||
|
int mCurrentUserId;
|
||||||
|
|
||||||
private class DisableRecord implements IBinder.DeathRecipient {
|
private class DisableRecord implements IBinder.DeathRecipient {
|
||||||
|
int userId;
|
||||||
String pkg;
|
String pkg;
|
||||||
int what;
|
int what;
|
||||||
IBinder token;
|
IBinder token;
|
||||||
|
|
||||||
public void binderDied() {
|
public void binderDied() {
|
||||||
Slog.i(TAG, "binder died for pkg=" + pkg);
|
Slog.i(TAG, "binder died for pkg=" + pkg);
|
||||||
disable(0, token, pkg);
|
disableInternal(userId, 0, token, pkg);
|
||||||
token.unlinkToDeath(this, 0);
|
token.unlinkToDeath(this, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -151,20 +153,24 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void disable(int what, IBinder token, String pkg) {
|
public void disable(int what, IBinder token, String pkg) {
|
||||||
|
disableInternal(mCurrentUserId, what, token, pkg);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void disableInternal(int userId, int what, IBinder token, String pkg) {
|
||||||
enforceStatusBar();
|
enforceStatusBar();
|
||||||
|
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
disableLocked(what, token, pkg);
|
disableLocked(userId, what, token, pkg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void disableLocked(int what, IBinder token, String pkg) {
|
private void disableLocked(int userId, int what, IBinder token, String pkg) {
|
||||||
// It's important that the the callback and the call to mBar get done
|
// 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
|
// in the same order when multiple threads are calling this function
|
||||||
// so they are paired correctly. The messages on the handler will be
|
// 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.
|
// handled in the order they were enqueued, but will be outside the lock.
|
||||||
manageDisableListLocked(what, token, pkg);
|
manageDisableListLocked(userId, what, token, pkg);
|
||||||
final int net = gatherDisableActionsLocked();
|
final int net = gatherDisableActionsLocked(userId);
|
||||||
if (net != mDisabled) {
|
if (net != mDisabled) {
|
||||||
mDisabled = net;
|
mDisabled = net;
|
||||||
mHandler.post(new Runnable() {
|
mHandler.post(new Runnable() {
|
||||||
@@ -312,7 +318,10 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
|||||||
|
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
updateUiVisibilityLocked(vis, mask);
|
updateUiVisibilityLocked(vis, mask);
|
||||||
disableLocked(vis & StatusBarManager.DISABLE_MASK, mSysUiVisToken,
|
disableLocked(
|
||||||
|
mCurrentUserId,
|
||||||
|
vis & StatusBarManager.DISABLE_MASK,
|
||||||
|
mSysUiVisToken,
|
||||||
"WindowManager.LayoutParams");
|
"WindowManager.LayoutParams");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -382,6 +391,12 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCurrentUser(int newUserId) {
|
||||||
|
if (SPEW) Slog.d(TAG, "Setting current user to user " + newUserId);
|
||||||
|
mCurrentUserId = newUserId;
|
||||||
|
}
|
||||||
|
|
||||||
private void enforceStatusBar() {
|
private void enforceStatusBar() {
|
||||||
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR,
|
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.STATUS_BAR,
|
||||||
"StatusBarManagerService");
|
"StatusBarManagerService");
|
||||||
@@ -417,7 +432,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
switches[0] = gatherDisableActionsLocked();
|
switches[0] = gatherDisableActionsLocked(mCurrentUserId);
|
||||||
switches[1] = mSystemUiVisibility;
|
switches[1] = mSystemUiVisibility;
|
||||||
switches[2] = mMenuVisible ? 1 : 0;
|
switches[2] = mMenuVisible ? 1 : 0;
|
||||||
switches[3] = mImeWindowVis;
|
switches[3] = mImeWindowVis;
|
||||||
@@ -518,9 +533,10 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
|||||||
// ================================================================================
|
// ================================================================================
|
||||||
|
|
||||||
// lock on mDisableRecords
|
// lock on mDisableRecords
|
||||||
void manageDisableListLocked(int what, IBinder token, String pkg) {
|
void manageDisableListLocked(int userId, int what, IBinder token, String pkg) {
|
||||||
if (SPEW) {
|
if (SPEW) {
|
||||||
Slog.d(TAG, "manageDisableList what=0x" + Integer.toHexString(what) + " pkg=" + pkg);
|
Slog.d(TAG, "manageDisableList userId=" + userId
|
||||||
|
+ " what=0x" + Integer.toHexString(what) + " pkg=" + pkg);
|
||||||
}
|
}
|
||||||
// update the list
|
// update the list
|
||||||
final int N = mDisableRecords.size();
|
final int N = mDisableRecords.size();
|
||||||
@@ -541,6 +557,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
|||||||
} else {
|
} else {
|
||||||
if (tok == null) {
|
if (tok == null) {
|
||||||
tok = new DisableRecord();
|
tok = new DisableRecord();
|
||||||
|
tok.userId = userId;
|
||||||
try {
|
try {
|
||||||
token.linkToDeath(tok, 0);
|
token.linkToDeath(tok, 0);
|
||||||
}
|
}
|
||||||
@@ -556,12 +573,15 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
// lock on mDisableRecords
|
// lock on mDisableRecords
|
||||||
int gatherDisableActionsLocked() {
|
int gatherDisableActionsLocked(int userId) {
|
||||||
final int N = mDisableRecords.size();
|
final int N = mDisableRecords.size();
|
||||||
// gather the new net flags
|
// gather the new net flags
|
||||||
int net = 0;
|
int net = 0;
|
||||||
for (int i=0; i<N; i++) {
|
for (int i=0; i<N; i++) {
|
||||||
net |= mDisableRecords.get(i).what;
|
final DisableRecord rec = mDisableRecords.get(i);
|
||||||
|
if (rec.userId == userId) {
|
||||||
|
net |= rec.what;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return net;
|
return net;
|
||||||
}
|
}
|
||||||
@@ -593,13 +613,15 @@ public class StatusBarManagerService extends IStatusBarService.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
|
pw.println(" mDisabled=0x" + Integer.toHexString(mDisabled));
|
||||||
final int N = mDisableRecords.size();
|
final int N = mDisableRecords.size();
|
||||||
pw.println(" mDisableRecords.size=" + N
|
pw.println(" mDisableRecords.size=" + N);
|
||||||
+ " mDisabled=0x" + Integer.toHexString(mDisabled));
|
|
||||||
for (int i=0; i<N; i++) {
|
for (int i=0; i<N; i++) {
|
||||||
DisableRecord tok = mDisableRecords.get(i);
|
DisableRecord tok = mDisableRecords.get(i);
|
||||||
pw.println(" [" + i + "] what=0x" + Integer.toHexString(tok.what)
|
pw.println(" [" + i + "] userId=" + tok.userId
|
||||||
+ " pkg=" + tok.pkg + " token=" + tok.token);
|
+ " what=0x" + Integer.toHexString(tok.what)
|
||||||
|
+ " pkg=" + tok.pkg
|
||||||
|
+ " token=" + tok.token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user