Loading core/java/android/service/quicksettings/IQSService.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -34,4 +34,5 @@ interface IQSService { void startUnlockAndRun(in Tile tile); void onDialogHidden(in Tile tile); void onStartSuccessful(in Tile tile); } core/java/android/service/quicksettings/Tile.java +1 −3 Original line number Diff line number Diff line Loading @@ -37,8 +37,6 @@ public final class Tile implements Parcelable { private static final String TAG = "Tile"; /** * This is the default state of any tile, until updated by the {@link TileService}. * <p> * An unavailable state indicates that for some reason this tile is not currently * available to the user for some reason, and will have no click action. The tile's * icon will be tinted differently to reflect this state. Loading @@ -57,7 +55,7 @@ public final class Tile implements Parcelable { /** * This represents a tile that is currently active. (e.g. wifi is connected, bluetooth is on, * cast is casting). * cast is casting). This is the default state. */ public static final int STATE_ACTIVE = 2; Loading packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java +8 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.qs.customize; import android.content.Context; import android.graphics.Canvas; import android.graphics.drawable.ColorDrawable; import android.os.Handler; import android.support.v4.view.ViewCompat; import android.support.v7.widget.GridLayoutManager.SpanSizeLookup; import android.support.v7.widget.RecyclerView; Loading Loading @@ -51,6 +52,7 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta private final Context mContext; private final Handler mHandler = new Handler(); private final List<TileInfo> mTiles = new ArrayList<>(); private final ItemTouchHelper mItemTouchHelper; private int mDividerIndex; Loading Loading @@ -262,8 +264,13 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta mCurrentDrag = (Holder) viewHolder; mCurrentDrag.startDrag(); } mHandler.post(new Runnable() { @Override public void run() { notifyItemChanged(mDividerIndex); } }); } @Override public int getMovementFlags(RecyclerView recyclerView, ViewHolder viewHolder) { Loading packages/SystemUI/src/com/android/systemui/qs/external/CustomTile.java +19 −3 Original line number Diff line number Diff line Loading @@ -75,7 +75,8 @@ public class CustomTile extends QSTile<QSTile.State> { mUser = ActivityManager.getCurrentUser(); try { PackageManager pm = mContext.getPackageManager(); ServiceInfo info = pm.getServiceInfo(mComponent, 0); ServiceInfo info = pm.getServiceInfo(mComponent, PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE); mTile.setIcon(android.graphics.drawable.Icon .createWithResource(mComponent.getPackageName(), info.icon)); mTile.setLabel(info.loadLabel(pm)); Loading @@ -88,6 +89,17 @@ public class CustomTile extends QSTile<QSTile.State> { } } @Override public boolean isAvailable() { try { ServiceInfo info = mContext.getPackageManager().getServiceInfo(mComponent, PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE); return true; } catch (Exception e) { return false; } } public int getUser() { return mUser; } Loading Loading @@ -211,11 +223,15 @@ public class CustomTile extends QSTile<QSTile.State> { @Override protected void handleUpdateState(State state, Object arg) { Drawable drawable = mTile.getIcon().loadDrawable(mContext); int color = mContext.getColor(getColor(mTile.getState())); int tileState = mTile.getState(); if (mServiceManager.hasPendingBind()) { tileState = Tile.STATE_UNAVAILABLE; } int color = mContext.getColor(getColor(tileState)); drawable.setTint(color); state.icon = new DrawableIcon(drawable); state.label = mTile.getLabel(); if (mTile.getState() == Tile.STATE_UNAVAILABLE) { if (tileState == Tile.STATE_UNAVAILABLE) { state.label = new SpannableStringBuilder().append(state.label, new ForegroundColorSpan(color), SpannableStringBuilder.SPAN_INCLUSIVE_INCLUSIVE); Loading packages/SystemUI/src/com/android/systemui/qs/external/TileLifecycleManager.java +8 −4 Original line number Diff line number Diff line Loading @@ -249,6 +249,8 @@ public class TileLifecycleManager extends BroadcastReceiver implements filter.addAction(Intent.ACTION_PACKAGE_CHANGED); filter.addDataScheme("package"); mContext.registerReceiverAsUser(this, mUser, filter, null, mHandler); filter = new IntentFilter(Intent.ACTION_USER_UNLOCKED); mContext.registerReceiverAsUser(this, mUser, filter, null, mHandler); mReceiverRegistered = true; } Loading @@ -261,11 +263,13 @@ public class TileLifecycleManager extends BroadcastReceiver implements @Override public void onReceive(Context context, Intent intent) { if (DEBUG) Log.d(TAG, "onReceive: " + intent); if (!Intent.ACTION_USER_UNLOCKED.equals(intent.getAction())) { Uri data = intent.getData(); String pkgName = data.getEncodedSchemeSpecificPart(); if (!Objects.equal(pkgName, mIntent.getComponent().getPackageName())) { return; } } stopPackageListening(); if (mBound) { // Trying to bind again will check the state of the package before bothering to bind. Loading Loading
core/java/android/service/quicksettings/IQSService.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -34,4 +34,5 @@ interface IQSService { void startUnlockAndRun(in Tile tile); void onDialogHidden(in Tile tile); void onStartSuccessful(in Tile tile); }
core/java/android/service/quicksettings/Tile.java +1 −3 Original line number Diff line number Diff line Loading @@ -37,8 +37,6 @@ public final class Tile implements Parcelable { private static final String TAG = "Tile"; /** * This is the default state of any tile, until updated by the {@link TileService}. * <p> * An unavailable state indicates that for some reason this tile is not currently * available to the user for some reason, and will have no click action. The tile's * icon will be tinted differently to reflect this state. Loading @@ -57,7 +55,7 @@ public final class Tile implements Parcelable { /** * This represents a tile that is currently active. (e.g. wifi is connected, bluetooth is on, * cast is casting). * cast is casting). This is the default state. */ public static final int STATE_ACTIVE = 2; Loading
packages/SystemUI/src/com/android/systemui/qs/customize/TileAdapter.java +8 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.qs.customize; import android.content.Context; import android.graphics.Canvas; import android.graphics.drawable.ColorDrawable; import android.os.Handler; import android.support.v4.view.ViewCompat; import android.support.v7.widget.GridLayoutManager.SpanSizeLookup; import android.support.v7.widget.RecyclerView; Loading Loading @@ -51,6 +52,7 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta private final Context mContext; private final Handler mHandler = new Handler(); private final List<TileInfo> mTiles = new ArrayList<>(); private final ItemTouchHelper mItemTouchHelper; private int mDividerIndex; Loading Loading @@ -262,8 +264,13 @@ public class TileAdapter extends RecyclerView.Adapter<Holder> implements TileSta mCurrentDrag = (Holder) viewHolder; mCurrentDrag.startDrag(); } mHandler.post(new Runnable() { @Override public void run() { notifyItemChanged(mDividerIndex); } }); } @Override public int getMovementFlags(RecyclerView recyclerView, ViewHolder viewHolder) { Loading
packages/SystemUI/src/com/android/systemui/qs/external/CustomTile.java +19 −3 Original line number Diff line number Diff line Loading @@ -75,7 +75,8 @@ public class CustomTile extends QSTile<QSTile.State> { mUser = ActivityManager.getCurrentUser(); try { PackageManager pm = mContext.getPackageManager(); ServiceInfo info = pm.getServiceInfo(mComponent, 0); ServiceInfo info = pm.getServiceInfo(mComponent, PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE); mTile.setIcon(android.graphics.drawable.Icon .createWithResource(mComponent.getPackageName(), info.icon)); mTile.setLabel(info.loadLabel(pm)); Loading @@ -88,6 +89,17 @@ public class CustomTile extends QSTile<QSTile.State> { } } @Override public boolean isAvailable() { try { ServiceInfo info = mContext.getPackageManager().getServiceInfo(mComponent, PackageManager.MATCH_ENCRYPTION_AWARE_AND_UNAWARE); return true; } catch (Exception e) { return false; } } public int getUser() { return mUser; } Loading Loading @@ -211,11 +223,15 @@ public class CustomTile extends QSTile<QSTile.State> { @Override protected void handleUpdateState(State state, Object arg) { Drawable drawable = mTile.getIcon().loadDrawable(mContext); int color = mContext.getColor(getColor(mTile.getState())); int tileState = mTile.getState(); if (mServiceManager.hasPendingBind()) { tileState = Tile.STATE_UNAVAILABLE; } int color = mContext.getColor(getColor(tileState)); drawable.setTint(color); state.icon = new DrawableIcon(drawable); state.label = mTile.getLabel(); if (mTile.getState() == Tile.STATE_UNAVAILABLE) { if (tileState == Tile.STATE_UNAVAILABLE) { state.label = new SpannableStringBuilder().append(state.label, new ForegroundColorSpan(color), SpannableStringBuilder.SPAN_INCLUSIVE_INCLUSIVE); Loading
packages/SystemUI/src/com/android/systemui/qs/external/TileLifecycleManager.java +8 −4 Original line number Diff line number Diff line Loading @@ -249,6 +249,8 @@ public class TileLifecycleManager extends BroadcastReceiver implements filter.addAction(Intent.ACTION_PACKAGE_CHANGED); filter.addDataScheme("package"); mContext.registerReceiverAsUser(this, mUser, filter, null, mHandler); filter = new IntentFilter(Intent.ACTION_USER_UNLOCKED); mContext.registerReceiverAsUser(this, mUser, filter, null, mHandler); mReceiverRegistered = true; } Loading @@ -261,11 +263,13 @@ public class TileLifecycleManager extends BroadcastReceiver implements @Override public void onReceive(Context context, Intent intent) { if (DEBUG) Log.d(TAG, "onReceive: " + intent); if (!Intent.ACTION_USER_UNLOCKED.equals(intent.getAction())) { Uri data = intent.getData(); String pkgName = data.getEncodedSchemeSpecificPart(); if (!Objects.equal(pkgName, mIntent.getComponent().getPackageName())) { return; } } stopPackageListening(); if (mBound) { // Trying to bind again will check the state of the package before bothering to bind. Loading