Fix missing service call when rebinding to VrCore
When rebinding to VrCore after a VrCore crash we weren't calling onCurrentVrActivityChanged(). Bug: b/69839187 Test: Went through the repro steps in b/69839187 and confirmed we successfully recover after VrCore dies and is rebound. Change-Id: Idbd7acb438e8b7754743c5ccaaa68b4e0a686d33 (cherry picked from commit d03fa742c2f29330d138ba6e2241f13eb527b9b5)
This commit is contained in:
@@ -185,6 +185,14 @@ public class VrManagerService extends SystemService
|
||||
ComponentName component = null;
|
||||
synchronized (mLock) {
|
||||
component = ((mCurrentVrService == null) ? null : mCurrentVrService.getComponent());
|
||||
|
||||
// If the VrCore main service was disconnected or the binding died we'll rebind
|
||||
// automatically. Call focusedActivityChanged() once we rebind.
|
||||
if (component != null && component.equals(event.component) &&
|
||||
(event.event == LogEvent.EVENT_DISCONNECTED ||
|
||||
event.event == LogEvent.EVENT_BINDING_DIED)) {
|
||||
callFocusedActivityChangedLocked();
|
||||
}
|
||||
}
|
||||
|
||||
// If not on an AIO device and we permanently stopped trying to connect to the
|
||||
@@ -980,16 +988,7 @@ public class VrManagerService extends SystemService
|
||||
oldVrServicePackage, oldUserId);
|
||||
|
||||
if (mCurrentVrService != null && sendUpdatedCaller) {
|
||||
final ComponentName c = mCurrentVrModeComponent;
|
||||
final boolean b = running2dInVr;
|
||||
final int pid = processId;
|
||||
mCurrentVrService.sendEvent(new PendingEvent() {
|
||||
@Override
|
||||
public void runEvent(IInterface service) throws RemoteException {
|
||||
IVrListener l = (IVrListener) service;
|
||||
l.focusedActivityChanged(c, b, pid);
|
||||
}
|
||||
});
|
||||
callFocusedActivityChangedLocked();
|
||||
}
|
||||
|
||||
if (!nothingChanged) {
|
||||
@@ -1002,6 +1001,23 @@ public class VrManagerService extends SystemService
|
||||
}
|
||||
}
|
||||
|
||||
private void callFocusedActivityChangedLocked() {
|
||||
final ComponentName c = mCurrentVrModeComponent;
|
||||
final boolean b = mRunning2dInVr;
|
||||
final int pid = mVrAppProcessId;
|
||||
mCurrentVrService.sendEvent(new PendingEvent() {
|
||||
@Override
|
||||
public void runEvent(IInterface service) throws RemoteException {
|
||||
// Under specific (and unlikely) timing scenarios, when VrCore
|
||||
// crashes and is rebound, focusedActivityChanged() may be
|
||||
// called a 2nd time with the same arguments. IVrListeners
|
||||
// should make sure to handle that scenario gracefully.
|
||||
IVrListener l = (IVrListener) service;
|
||||
l.focusedActivityChanged(c, b, pid);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean isDefaultAllowed(String packageName) {
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user