Merge \"QS Tiles: Fix some problems with connecting through intent\" into nyc-dev
am: 126088536d
Change-Id: Ie187a5c2e062f9b51fd21e80e81cac15f02ccbe6
This commit is contained in:
@@ -23,6 +23,7 @@ import android.service.quicksettings.Tile;
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
interface IQSService {
|
interface IQSService {
|
||||||
|
Tile getTile(in ComponentName component);
|
||||||
void updateQsTile(in Tile tile);
|
void updateQsTile(in Tile tile);
|
||||||
void updateStatusIcon(in Tile tile, in Icon icon,
|
void updateStatusIcon(in Tile tile, in Icon icon,
|
||||||
String contentDescription);
|
String contentDescription);
|
||||||
|
|||||||
@@ -120,11 +120,6 @@ public class TileService extends Service {
|
|||||||
*/
|
*/
|
||||||
public static final String EXTRA_SERVICE = "service";
|
public static final String EXTRA_SERVICE = "service";
|
||||||
|
|
||||||
/**
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
public static final String EXTRA_TILE = "tile";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
@@ -315,9 +310,16 @@ public class TileService extends Service {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBinder onBind(Intent intent) {
|
public IBinder onBind(Intent intent) {
|
||||||
mTile = intent.getParcelableExtra(EXTRA_TILE);
|
|
||||||
mService = IQSService.Stub.asInterface(intent.getIBinderExtra(EXTRA_SERVICE));
|
mService = IQSService.Stub.asInterface(intent.getIBinderExtra(EXTRA_SERVICE));
|
||||||
mTile.setService(mService);
|
try {
|
||||||
|
mTile = mService.getTile(new ComponentName(getPackageName(), getClass().getName()));
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
throw new RuntimeException("Unable to reach IQSService", e);
|
||||||
|
}
|
||||||
|
if (mTile != null) {
|
||||||
|
mTile.setService(mService);
|
||||||
|
mHandler.sendEmptyMessage(H.MSG_START_SUCCESS);
|
||||||
|
}
|
||||||
return new IQSTileService.Stub() {
|
return new IQSTileService.Stub() {
|
||||||
@Override
|
@Override
|
||||||
public void onTileRemoved() throws RemoteException {
|
public void onTileRemoved() throws RemoteException {
|
||||||
@@ -358,6 +360,7 @@ public class TileService extends Service {
|
|||||||
private static final int MSG_TILE_REMOVED = 4;
|
private static final int MSG_TILE_REMOVED = 4;
|
||||||
private static final int MSG_TILE_CLICKED = 5;
|
private static final int MSG_TILE_CLICKED = 5;
|
||||||
private static final int MSG_UNLOCK_COMPLETE = 6;
|
private static final int MSG_UNLOCK_COMPLETE = 6;
|
||||||
|
private static final int MSG_START_SUCCESS = 7;
|
||||||
|
|
||||||
public H(Looper looper) {
|
public H(Looper looper) {
|
||||||
super(looper);
|
super(looper);
|
||||||
@@ -397,6 +400,12 @@ public class TileService extends Service {
|
|||||||
mUnlockRunnable.run();
|
mUnlockRunnable.run();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case MSG_START_SUCCESS:
|
||||||
|
try {
|
||||||
|
mService.onStartSuccessful(mTile);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,6 @@ public class TileLifecycleManager extends BroadcastReceiver implements
|
|||||||
mHandler = handler;
|
mHandler = handler;
|
||||||
mIntent = intent;
|
mIntent = intent;
|
||||||
mIntent.putExtra(TileService.EXTRA_SERVICE, service.asBinder());
|
mIntent.putExtra(TileService.EXTRA_SERVICE, service.asBinder());
|
||||||
mIntent.putExtra(TileService.EXTRA_TILE, tile);
|
|
||||||
mUser = user;
|
mUser = user;
|
||||||
if (DEBUG) Log.d(TAG, "Creating " + mIntent + " " + mUser);
|
if (DEBUG) Log.d(TAG, "Creating " + mIntent + " " + mUser);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,6 +262,16 @@ public class TileServices extends IQSService.Stub {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Tile getTile(ComponentName componentName) {
|
||||||
|
verifyCaller(componentName.getPackageName());
|
||||||
|
CustomTile customTile = getTileForComponent(componentName);
|
||||||
|
if (customTile != null) {
|
||||||
|
return customTile.getQsTile();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startUnlockAndRun(Tile tile) {
|
public void startUnlockAndRun(Tile tile) {
|
||||||
ComponentName componentName = tile.getComponentName();
|
ComponentName componentName = tile.getComponentName();
|
||||||
|
|||||||
Reference in New Issue
Block a user