Loading core/java/android/service/quicksettings/IQSService.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -32,4 +32,6 @@ interface IQSService { boolean isLocked(); boolean isSecure(); void startUnlockAndRun(in Tile tile); void onDialogHidden(in Tile tile); } core/java/android/service/quicksettings/TileService.java +16 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,8 @@ import android.os.IBinder; import android.os.Looper; import android.os.Message; import android.os.RemoteException; import android.view.View; import android.view.View.OnAttachStateChangeListener; import android.view.WindowManager; /** Loading Loading @@ -206,6 +208,20 @@ public class TileService extends Service { public final void showDialog(Dialog dialog) { dialog.getWindow().getAttributes().token = mToken; dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_QS_DIALOG); dialog.getWindow().getDecorView().addOnAttachStateChangeListener( new OnAttachStateChangeListener() { @Override public void onViewAttachedToWindow(View v) { } @Override public void onViewDetachedFromWindow(View v) { try { mService.onDialogHidden(getQsTile()); } catch (RemoteException e) { } } }); dialog.show(); try { mService.onShowDialog(mTile); Loading packages/SystemUI/src/com/android/systemui/qs/external/CustomTile.java +9 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,15 @@ public class CustomTile extends QSTile<QSTile.State> { mIsShowingDialog = true; } public void onDialogHidden() { mIsShowingDialog = false; try { if (DEBUG) Log.d(TAG, "Removing token"); mWindowManager.removeWindowToken(mToken); } catch (RemoteException e) { } } @Override public void setListening(boolean listening) { if (mListening == listening) return; Loading packages/SystemUI/src/com/android/systemui/qs/external/TileServiceManager.java +11 −3 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ public class TileServiceManager { private boolean mJustBound; private long mLastUpdate; private int mType; private boolean mShowingDialog; TileServiceManager(TileServices tileServices, Handler handler, ComponentName component) { this(tileServices, handler, new TileLifecycleManager(handler, Loading Loading @@ -86,6 +87,10 @@ public class TileServiceManager { mServices.recalculateBindAllowance(); } public void setShowingDialog(boolean dialog) { mShowingDialog = dialog; } public IQSTileService getTileService() { return mStateManager; } Loading Loading @@ -153,10 +158,13 @@ public class TileServiceManager { // Pending click is the most important thing, need to put this service at the top of // the list to be bound. mPriority = Integer.MAX_VALUE; } else if (mShowingDialog) { // Hang on to services that are showing dialogs so they don't die. mPriority = Integer.MAX_VALUE - 1; } else if (mJustBound) { // If we just bound, lets not thrash on binding/unbinding too much, this is second most // important. mPriority = Integer.MAX_VALUE - 1; mPriority = Integer.MAX_VALUE - 2; } else if (!mBindRequested) { // Don't care about binding right now, put us last. mPriority = Integer.MIN_VALUE; Loading @@ -165,8 +173,8 @@ public class TileServiceManager { long timeSinceUpdate = currentTime - mLastUpdate; // Fit compare into integer space for simplicity. Make sure to leave MAX_VALUE and // MAX_VALUE - 1 for the more important states above. if (timeSinceUpdate > Integer.MAX_VALUE - 2) { mPriority = Integer.MAX_VALUE - 2; if (timeSinceUpdate > Integer.MAX_VALUE - 3) { mPriority = Integer.MAX_VALUE - 3; } else { mPriority = (int) timeSinceUpdate; } Loading packages/SystemUI/src/com/android/systemui/qs/external/TileServices.java +12 −0 Original line number Diff line number Diff line Loading @@ -197,6 +197,18 @@ public class TileServices extends IQSService.Stub { if (customTile != null) { customTile.onDialogShown(); mHost.collapsePanels(); mServices.get(customTile).setShowingDialog(true); } } @Override public void onDialogHidden(Tile tile) { ComponentName componentName = tile.getComponentName(); verifyCaller(componentName.getPackageName()); CustomTile customTile = getTileForComponent(componentName); if (customTile != null) { mServices.get(customTile).setShowingDialog(false); customTile.onDialogHidden(); } } Loading Loading
core/java/android/service/quicksettings/IQSService.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -32,4 +32,6 @@ interface IQSService { boolean isLocked(); boolean isSecure(); void startUnlockAndRun(in Tile tile); void onDialogHidden(in Tile tile); }
core/java/android/service/quicksettings/TileService.java +16 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,8 @@ import android.os.IBinder; import android.os.Looper; import android.os.Message; import android.os.RemoteException; import android.view.View; import android.view.View.OnAttachStateChangeListener; import android.view.WindowManager; /** Loading Loading @@ -206,6 +208,20 @@ public class TileService extends Service { public final void showDialog(Dialog dialog) { dialog.getWindow().getAttributes().token = mToken; dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_QS_DIALOG); dialog.getWindow().getDecorView().addOnAttachStateChangeListener( new OnAttachStateChangeListener() { @Override public void onViewAttachedToWindow(View v) { } @Override public void onViewDetachedFromWindow(View v) { try { mService.onDialogHidden(getQsTile()); } catch (RemoteException e) { } } }); dialog.show(); try { mService.onShowDialog(mTile); Loading
packages/SystemUI/src/com/android/systemui/qs/external/CustomTile.java +9 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,15 @@ public class CustomTile extends QSTile<QSTile.State> { mIsShowingDialog = true; } public void onDialogHidden() { mIsShowingDialog = false; try { if (DEBUG) Log.d(TAG, "Removing token"); mWindowManager.removeWindowToken(mToken); } catch (RemoteException e) { } } @Override public void setListening(boolean listening) { if (mListening == listening) return; Loading
packages/SystemUI/src/com/android/systemui/qs/external/TileServiceManager.java +11 −3 Original line number Diff line number Diff line Loading @@ -52,6 +52,7 @@ public class TileServiceManager { private boolean mJustBound; private long mLastUpdate; private int mType; private boolean mShowingDialog; TileServiceManager(TileServices tileServices, Handler handler, ComponentName component) { this(tileServices, handler, new TileLifecycleManager(handler, Loading Loading @@ -86,6 +87,10 @@ public class TileServiceManager { mServices.recalculateBindAllowance(); } public void setShowingDialog(boolean dialog) { mShowingDialog = dialog; } public IQSTileService getTileService() { return mStateManager; } Loading Loading @@ -153,10 +158,13 @@ public class TileServiceManager { // Pending click is the most important thing, need to put this service at the top of // the list to be bound. mPriority = Integer.MAX_VALUE; } else if (mShowingDialog) { // Hang on to services that are showing dialogs so they don't die. mPriority = Integer.MAX_VALUE - 1; } else if (mJustBound) { // If we just bound, lets not thrash on binding/unbinding too much, this is second most // important. mPriority = Integer.MAX_VALUE - 1; mPriority = Integer.MAX_VALUE - 2; } else if (!mBindRequested) { // Don't care about binding right now, put us last. mPriority = Integer.MIN_VALUE; Loading @@ -165,8 +173,8 @@ public class TileServiceManager { long timeSinceUpdate = currentTime - mLastUpdate; // Fit compare into integer space for simplicity. Make sure to leave MAX_VALUE and // MAX_VALUE - 1 for the more important states above. if (timeSinceUpdate > Integer.MAX_VALUE - 2) { mPriority = Integer.MAX_VALUE - 2; if (timeSinceUpdate > Integer.MAX_VALUE - 3) { mPriority = Integer.MAX_VALUE - 3; } else { mPriority = (int) timeSinceUpdate; } Loading
packages/SystemUI/src/com/android/systemui/qs/external/TileServices.java +12 −0 Original line number Diff line number Diff line Loading @@ -197,6 +197,18 @@ public class TileServices extends IQSService.Stub { if (customTile != null) { customTile.onDialogShown(); mHost.collapsePanels(); mServices.get(customTile).setShowingDialog(true); } } @Override public void onDialogHidden(Tile tile) { ComponentName componentName = tile.getComponentName(); verifyCaller(componentName.getPackageName()); CustomTile customTile = getTileForComponent(componentName); if (customTile != null) { mServices.get(customTile).setShowingDialog(false); customTile.onDialogHidden(); } } Loading