public class ServiceWatcher extends Object implements ServiceConnection
Modifier and Type | Field and Description |
---|---|
static String |
EXTRA_SERVICE_IS_MULTIUSER |
static String |
EXTRA_SERVICE_VERSION |
Constructor and Description |
---|
ServiceWatcher(Context context,
String logTag,
String action,
int overlaySwitchResId,
int defaultServicePackageNameResId,
int initialPackageNamesResId,
Runnable newServiceWork,
Handler handler) |
Modifier and Type | Method and Description |
---|---|
String |
getBestPackageName() |
int |
getBestVersion() |
IBinder |
getBinder() |
static ArrayList<HashSet<Signature>> |
getSignatureSets(Context context,
List<String> initialPackageNames) |
static boolean |
isSignatureMatch(Signature[] signatures,
List<HashSet<Signature>> sigSets) |
void |
onServiceConnected(ComponentName component,
IBinder binder)
Called when a connection to the Service has been established, with
the
IBinder of the communication channel to the
Service. |
void |
onServiceDisconnected(ComponentName component)
Called when a connection to the Service has been lost.
|
boolean |
start()
Start this watcher, including binding to the current best match and
re-binding to any better matches down the road.
|
void |
switchUser(int userId) |
void |
unlockUser(int userId) |
public static final String EXTRA_SERVICE_VERSION
public static final String EXTRA_SERVICE_IS_MULTIUSER
public static ArrayList<HashSet<Signature>> getSignatureSets(Context context, List<String> initialPackageNames)
public boolean start()
Note that if there are no matching encryption-aware services, we may not bind to a real service until after the current user is unlocked.
public static boolean isSignatureMatch(Signature[] signatures, List<HashSet<Signature>> sigSets)
public void onServiceConnected(ComponentName component, IBinder binder)
ServiceConnection
IBinder
of the communication channel to the
Service.onServiceConnected
in interface ServiceConnection
component
- The concrete component name of the service that has
been connected.binder
- The IBinder of the Service's communication channel,
which you can now make calls on.public void onServiceDisconnected(ComponentName component)
ServiceConnection
ServiceConnection.onServiceConnected(android.content.ComponentName, android.os.IBinder)
when the Service is next running.onServiceDisconnected
in interface ServiceConnection
component
- The concrete component name of the service whose
connection has been lost.public String getBestPackageName()
public int getBestVersion()
public IBinder getBinder()
public void switchUser(int userId)
public void unlockUser(int userId)