Skip to content

Commit 919adac

Browse files
author
John Spurlock
committed
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
1 parent 30ed33b commit 919adac

File tree

2 files changed

+41
-2
lines changed

2 files changed

+41
-2
lines changed

packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ public boolean onTouchEvent(MotionEvent event) {
8383
// figure out which panel needs to be talked to here
8484
if (event.getAction() == MotionEvent.ACTION_DOWN) {
8585
final PanelView panel = selectPanelForTouchX(event.getX());
86-
LOG("PanelBar.onTouch: state=%d ACTION_DOWN: panel %s", mState, panel);
86+
boolean enabled = panel.isEnabled();
87+
LOG("PanelBar.onTouch: state=%d ACTION_DOWN: panel %s %s", mState, panel,
88+
(enabled ? "" : " (disabled)"));
89+
if (!enabled)
90+
return false;
8791
startOpeningPanel(panel);
8892
}
8993
final boolean result = mTouchingPanel.getHandle().dispatchTouchEvent(event);

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import android.content.Intent;
3131
import android.content.IntentFilter;
3232
import android.content.res.Resources;
33+
import android.database.ContentObserver;
3334
import android.graphics.Canvas;
3435
import android.graphics.ColorFilter;
3536
import android.graphics.PixelFormat;
@@ -39,6 +40,7 @@
3940
import android.graphics.drawable.Drawable;
4041
import android.graphics.drawable.NinePatchDrawable;
4142
import android.inputmethodservice.InputMethodService;
43+
import android.os.Handler;
4244
import android.os.IBinder;
4345
import android.os.Message;
4446
import android.os.RemoteException;
@@ -259,6 +261,26 @@ public void onAnimationEnd(Animator animation) {
259261
}
260262
};
261263

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+
262284
@Override
263285
public void start() {
264286
mDisplay = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE))
@@ -461,6 +483,9 @@ public void onSizeChanged(View view, int w, int h, int oldw, int oldh) {
461483
filter.addAction(Intent.ACTION_SCREEN_ON);
462484
context.registerReceiver(mBroadcastReceiver, filter);
463485

486+
// listen for USER_SETUP_COMPLETE setting (per-user)
487+
resetUserSetupObserver();
488+
464489
return mStatusBarView;
465490
}
466491

@@ -1827,8 +1852,18 @@ public void userSwitched(int newUserId) {
18271852
if (MULTIUSER_DEBUG) mNotificationPanelDebugText.setText("USER " + newUserId);
18281853
animateCollapsePanels();
18291854
updateNotificationIcons();
1855+
resetUserSetupObserver();
18301856
}
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+
18321867
private void setIntruderAlertVisibility(boolean vis) {
18331868
if (!ENABLE_INTRUDERS) return;
18341869
if (DEBUG) {

0 commit comments

Comments
 (0)