summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/statusbar
diff options
context:
space:
mode:
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/statusbar')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java57
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java7
2 files changed, 53 insertions, 11 deletions
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 f518d9d..6e104ad 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -136,6 +136,7 @@ import com.android.systemui.doze.DozeLog;
import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.qs.QSDragPanel;
import com.android.systemui.qs.QSPanel;
+import com.android.systemui.qs.QSTile;
import com.android.systemui.recents.ScreenPinningRequest;
import com.android.systemui.settings.BrightnessController;
import com.android.systemui.statusbar.ActivatableNotificationView;
@@ -1205,6 +1206,40 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
}, 500);
}
+
+ @Override
+ public void resetTiles() {
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ mQSPanel.setEditing(false);
+ mHeader.setEditing(false);
+
+ // unregister custom tile service while we reset to not get
+ // callbacks from custom tiles
+ try {
+ mCustomTileListenerService.unregisterAsSystemService();
+ } catch (RemoteException e) {
+ Log.e(TAG, "Unable to unregister custom tile listener", e);
+ }
+
+ // clear out old tile states and views
+ mQSPanel.setTiles(new ArrayList<QSTile<?>>());
+
+ mQSTileHost.resetTiles();
+
+ // reregister service
+ try {
+ mCustomTileListenerService.registerAsSystemService(mContext,
+ new ComponentName(mContext.getPackageName(),
+ PhoneStatusBar.this.getClass().getCanonicalName()),
+ UserHandle.USER_ALL);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Unable to register custom tile listener", e);
+ }
+ }
+ });
+ }
});
}
@@ -3690,6 +3725,17 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
}
+ if (mCustomTileListenerService != null) {
+ try {
+ mCustomTileListenerService.unregisterAsSystemService();
+ } catch (RemoteException e) {
+ Log.e(TAG, "Unable to unregister custom tile listener", e);
+ }
+ }
+
+ mQSPanel.getHost().setCustomTileListenerService(null);
+ mQSPanel.setTiles(new ArrayList<QSTile<?>>());
+
makeStatusBarView();
repositionNavigationBar();
@@ -3716,16 +3762,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
// Stop the command queue until the new status bar container settles and has a layout pass
mCommandQueue.pause();
- if (mCustomTileListenerService != null) {
- try {
- mCustomTileListenerService.unregisterAsSystemService();
- } catch (RemoteException e) {
- Log.e(TAG, "Unable to unregister custom tile listener", e);
- }
- }
-
- mQSPanel.getHost().setCustomTileListenerService(null);
-
// fix notification panel being shifted to the left by calling
// instantCollapseNotificationPanel()
instantCollapseNotificationPanel();
@@ -3736,6 +3772,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
@Override
public void onGlobalLayout() {
mStatusBarWindow.getViewTreeObserver().removeOnGlobalLayoutListener(this);
+ mQSPanel.setTiles(mQSTileHost.getTiles());
mCommandQueue.resume();
mRecreating = false;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java
index ad881f9..c4ce350 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QSTileHost.java
@@ -413,9 +413,14 @@ public class QSTileHost implements QSTile.Host, Tunable {
TextUtils.join(",", tiles), ActivityManager.getCurrentUser());
}
+ public void initiateReset() {
+ if (mCallback != null) {
+ mCallback.resetTiles();
+ }
+ }
+
@Override
public void resetTiles() {
- setEditing(false);
CMSettings.Secure.putStringForUser(getContext().getContentResolver(),
CMSettings.Secure.QS_TILES, "default", ActivityManager.getCurrentUser());
}