|
30 | 30 | import android.content.Intent; |
31 | 31 | import android.content.IntentFilter; |
32 | 32 | import android.content.res.Resources; |
| 33 | +import android.database.ContentObserver; |
33 | 34 | import android.graphics.Canvas; |
34 | 35 | import android.graphics.ColorFilter; |
35 | 36 | import android.graphics.PixelFormat; |
|
39 | 40 | import android.graphics.drawable.Drawable; |
40 | 41 | import android.graphics.drawable.NinePatchDrawable; |
41 | 42 | import android.inputmethodservice.InputMethodService; |
| 43 | +import android.os.Handler; |
42 | 44 | import android.os.IBinder; |
43 | 45 | import android.os.Message; |
44 | 46 | import android.os.RemoteException; |
@@ -259,6 +261,26 @@ public void onAnimationEnd(Animator animation) { |
259 | 261 | } |
260 | 262 | }; |
261 | 263 |
|
| 264 | + // ensure quick settings is disabled until the current user makes it through the setup wizard |
| 265 | + private boolean mUserSetup = false; |
| 266 | + private ContentObserver mUserSetupObserver = new ContentObserver(new Handler()) { |
| 267 | + @Override |
| 268 | + public void onChange(boolean selfChange) { |
| 269 | + final boolean userSetup = 0 != Settings.Secure.getIntForUser( |
| 270 | + mContext.getContentResolver(), |
| 271 | + Settings.Secure.USER_SETUP_COMPLETE, |
| 272 | + 0 /*default */, |
| 273 | + mCurrentUserId); |
| 274 | + if (userSetup != mUserSetup) { |
| 275 | + mUserSetup = userSetup; |
| 276 | + if (mSettingsPanel != null) |
| 277 | + mSettingsPanel.setEnabled(mUserSetup); |
| 278 | + if (!mUserSetup && mStatusBarView != null) |
| 279 | + animateCollapseQuickSettings(); |
| 280 | + } |
| 281 | + } |
| 282 | + }; |
| 283 | + |
262 | 284 | @Override |
263 | 285 | public void start() { |
264 | 286 | mDisplay = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE)) |
@@ -461,6 +483,9 @@ public void onSizeChanged(View view, int w, int h, int oldw, int oldh) { |
461 | 483 | filter.addAction(Intent.ACTION_SCREEN_ON); |
462 | 484 | context.registerReceiver(mBroadcastReceiver, filter); |
463 | 485 |
|
| 486 | + // listen for USER_SETUP_COMPLETE setting (per-user) |
| 487 | + resetUserSetupObserver(); |
| 488 | + |
464 | 489 | return mStatusBarView; |
465 | 490 | } |
466 | 491 |
|
@@ -1827,8 +1852,18 @@ public void userSwitched(int newUserId) { |
1827 | 1852 | if (MULTIUSER_DEBUG) mNotificationPanelDebugText.setText("USER " + newUserId); |
1828 | 1853 | animateCollapsePanels(); |
1829 | 1854 | updateNotificationIcons(); |
| 1855 | + resetUserSetupObserver(); |
1830 | 1856 | } |
1831 | | - |
| 1857 | + |
| 1858 | + private void resetUserSetupObserver() { |
| 1859 | + mContext.getContentResolver().unregisterContentObserver(mUserSetupObserver); |
| 1860 | + mUserSetupObserver.onChange(false); |
| 1861 | + mContext.getContentResolver().registerContentObserver( |
| 1862 | + Settings.Secure.getUriFor(Settings.Secure.USER_SETUP_COMPLETE), true, |
| 1863 | + mUserSetupObserver, |
| 1864 | + mCurrentUserId); |
| 1865 | + } |
| 1866 | + |
1832 | 1867 | private void setIntruderAlertVisibility(boolean vis) { |
1833 | 1868 | if (!ENABLE_INTRUDERS) return; |
1834 | 1869 | if (DEBUG) { |
|
0 commit comments