bughelp wanted
説明
问题: 当插件调用宿主的aidl服务时,存在sServerChannel已经死掉的情况。当RePlugin重建sServerChannel时,并没有去给sServerChannel设置之前存在的aidl服务。因此导致插件调用aidl服务时失败。
相关代码: com.qihoo360.mobilesafe.svcmanager.QihooServiceManager类:
static IServiceChannel getServerChannel(Context context) {
if (DEBUG) {
Log.d(TAG, "[getServerChannel] begin = " + SystemClock.elapsedRealtime());
}
if (sServerChannel != null && sServerChannel.asBinder().isBinderAlive() && sServerChannel.asBinder().pingBinder()) {
return sServerChannel;
}
/*
* In server process we can return
* ServerChannelCreator.serviceChannelImpl directly instead of querying
* it using content resolver
*/
if (IPC.isPersistentProcess()) {
return ServiceChannelImpl.sServiceChannelImpl;
}
if (context == null) {
return null;
}
IServiceChannel serviceChannel = null;
Cursor cursor = null;
try {
cursor = context.getContentResolver().query(getServiceChannelUri(), null, null, null, null);
IBinder binder = ServiceChannelCursor.getBinder(cursor);
serviceChannel = IServiceChannel.Stub.asInterface(binder);
// 这里没有恢复sServerChannel之前注册的aidl服务
sServerChannel = serviceChannel;
} catch (Exception e) {
if (DEBUG) {
Log.e(TAG, "Error fetching service manager binder object using provider: ", e);
}
} finally {
if (cursor != null) {
try {
cursor.close();
} catch (Exception e) {
if (DEBUG) {
Log.e(TAG, "Error closing cursor: ", e);
}
}
}
}
if (DEBUG) {
Log.d(TAG, "[getServerChannel] end = " + SystemClock.elapsedRealtime());
}
return serviceChannel;
}
RePlugin version: 2.1.5 Android compile SDK version: 7.0 Android ROM: