1.死亡回调
private final ServiceConnection connection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
logD("launcher aidl connected");
iLauncher = ILauncher.Stub.asInterface(service);
try {
iLauncher.asBinder().linkToDeath(new IBinder.DeathRecipient() {
@Override
public void binderDied() {
Log.d(TAG,"[binderDied] retry bindService!");
iLauncher = null;
bindService();
}
},0);
} catch (RemoteException e) {
e.printStackTrace();
}
}
@Override
public void onServiceDisconnected(ComponentName name) {
logD("launcher aidl disconnected");
}
};