diff options
author | John Spurlock <jspurlock@google.com> | 2012-10-02 16:41:12 -0400 |
---|---|---|
committer | John Spurlock <jspurlock@google.com> | 2012-10-02 16:48:24 -0400 |
commit | 919adac28bd6a9888c3bbd53a1736f260bc76bbf (patch) | |
tree | 0581de33764bbfb9fb5cf966d7b50a8d4ac39b8f /packages | |
parent | 30ed33b141dd1add916466c193b6735cd0bf8315 (diff) | |
download | frameworks_base-919adac28bd6a9888c3bbd53a1736f260bc76bbf.zip frameworks_base-919adac28bd6a9888c3bbd53a1736f260bc76bbf.tar.gz frameworks_base-919adac28bd6a9888c3bbd53a1736f260bc76bbf.tar.bz2 |
Disable quick settings for users until USER_SETUP_COMPLETE.
If the current user has not yet made it through the setup wizard,
disable the quick settings panel entirely.
Use Settings.Secure.USER_SETUP_COMPLETE as the signal. This is a
per-user setting, so be careful to observe only on the current user's
behalf.
Bug:6712493
Change-Id: I3076a8a550165a9eeccf7fb129d470ef4ddeaed4
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java | 6 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java | 37 |
2 files changed, 41 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java index f623692..6b9bc89 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java @@ -83,7 +83,11 @@ public class PanelBar extends FrameLayout { // figure out which panel needs to be talked to here if (event.getAction() == MotionEvent.ACTION_DOWN) { final PanelView panel = selectPanelForTouchX(event.getX()); - LOG("PanelBar.onTouch: state=%d ACTION_DOWN: panel %s", mState, panel); + boolean enabled = panel.isEnabled(); + LOG("PanelBar.onTouch: state=%d ACTION_DOWN: panel %s %s", mState, panel, + (enabled ? "" : " (disabled)")); + if (!enabled) + return false; startOpeningPanel(panel); } final boolean result = mTouchingPanel.getHandle().dispatchTouchEvent(event); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 12e749d..493a92a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -30,6 +30,7 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Resources; +import android.database.ContentObserver; import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.PixelFormat; @@ -39,6 +40,7 @@ import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.graphics.drawable.NinePatchDrawable; import android.inputmethodservice.InputMethodService; +import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.RemoteException; @@ -259,6 +261,26 @@ public class PhoneStatusBar extends BaseStatusBar { } }; + // ensure quick settings is disabled until the current user makes it through the setup wizard + private boolean mUserSetup = false; + private ContentObserver mUserSetupObserver = new ContentObserver(new Handler()) { + @Override + public void onChange(boolean selfChange) { + final boolean userSetup = 0 != Settings.Secure.getIntForUser( + mContext.getContentResolver(), + Settings.Secure.USER_SETUP_COMPLETE, + 0 /*default */, + mCurrentUserId); + if (userSetup != mUserSetup) { + mUserSetup = userSetup; + if (mSettingsPanel != null) + mSettingsPanel.setEnabled(mUserSetup); + if (!mUserSetup && mStatusBarView != null) + animateCollapseQuickSettings(); + } + } + }; + @Override public void start() { mDisplay = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE)) @@ -461,6 +483,9 @@ public class PhoneStatusBar extends BaseStatusBar { filter.addAction(Intent.ACTION_SCREEN_ON); context.registerReceiver(mBroadcastReceiver, filter); + // listen for USER_SETUP_COMPLETE setting (per-user) + resetUserSetupObserver(); + return mStatusBarView; } @@ -1827,8 +1852,18 @@ public class PhoneStatusBar extends BaseStatusBar { if (MULTIUSER_DEBUG) mNotificationPanelDebugText.setText("USER " + newUserId); animateCollapsePanels(); updateNotificationIcons(); + resetUserSetupObserver(); } - + + private void resetUserSetupObserver() { + mContext.getContentResolver().unregisterContentObserver(mUserSetupObserver); + mUserSetupObserver.onChange(false); + mContext.getContentResolver().registerContentObserver( + Settings.Secure.getUriFor(Settings.Secure.USER_SETUP_COMPLETE), true, + mUserSetupObserver, + mCurrentUserId); + } + private void setIntruderAlertVisibility(boolean vis) { if (!ENABLE_INTRUDERS) return; if (DEBUG) { |