return mMainThread.getApplicationThread();
}
+ /** @hide */
+ @Override
+ public Handler getMainThreadHandler() {
+ return mMainThread.getHandler();
+ }
+
private boolean bindServiceCommon(Intent service, ServiceConnection conn, int flags, Handler
handler, UserHandle user) {
// Keep this in sync with DevicePolicyManager.bindDeviceAdminServiceAsUser.
* @param serviceIntent Identifies the service to connect to. The Intent must specify either an
* explicit component name or a package name to match an
* {@link IntentFilter} published by a service.
- * @param conn Receives information as the service is started and stopped. This must be a
- * valid {@link ServiceConnection} object; it must not be {@code null}.
+ * @param conn Receives information as the service is started and stopped in main thread. This
+ * must be a valid {@link ServiceConnection} object; it must not be {@code null}.
* @param flags Operation options for the binding operation. See
* {@link Context#bindService(Intent, ServiceConnection, int)}.
* @param targetUser Which user to bind to. Must be one of the users returned by
throwIfParentInstance("bindDeviceAdminServiceAsUser");
// Keep this in sync with ContextImpl.bindServiceCommon.
try {
- final IServiceConnection sd = mContext.getServiceDispatcher(conn, null, flags);
+ final IServiceConnection sd = mContext.getServiceDispatcher(
+ conn, mContext.getMainThreadHandler(), flags);
serviceIntent.prepareToLeaveProcess(mContext);
return mService.bindDeviceAdminServiceAsUser(admin,
mContext.getIApplicationThread(), mContext.getActivityToken(), serviceIntent,
public IApplicationThread getIApplicationThread() {
throw new RuntimeException("Not implemented. Must override in a subclass.");
}
+
+ /**
+ * @hide
+ */
+ public Handler getMainThreadHandler() {
+ throw new RuntimeException("Not implemented. Must override in a subclass.");
+ }
}