Switched from AM.getFocusedStackId() to getFocusedStackInfo() API.
Old API was removed in favor of the new one.
Test: builds.
Change-Id: Iadf6ec74a14516ecf18ee7cbd4ce20a63959d5fa
diff --git a/service/src/com/android/car/SystemActivityMonitoringService.java b/service/src/com/android/car/SystemActivityMonitoringService.java
index 2ff4e0e..4744ae5 100644
--- a/service/src/com/android/car/SystemActivityMonitoringService.java
+++ b/service/src/com/android/car/SystemActivityMonitoringService.java
@@ -208,7 +208,12 @@
}
int focusedStackId = -1;
try {
- focusedStackId = mAm.getFocusedStackId();
+ // TODO(b/66955160): Someone on the Auto-team should probably re-work the code in the
+ // synchronized block below based on this new API.
+ final StackInfo focusedStackInfo = mAm.getFocusedStackInfo();
+ if (focusedStackInfo != null) {
+ focusedStackId = focusedStackInfo.stackId;
+ }
} catch (RemoteException e) {
Log.e(CarLog.TAG_AM, "cannot getFocusedStackId", e);
return;
@@ -251,16 +256,9 @@
}
public StackInfo getFocusedStackForTopActivity(ComponentName activity) {
- int focusedStackId = -1;
- try {
- focusedStackId = mAm.getFocusedStackId();
- } catch (RemoteException e) {
- Log.e(CarLog.TAG_AM, "cannot getFocusedStackId", e);
- return null;
- }
StackInfo focusedStack;
try {
- focusedStack = mAm.getStackInfo(focusedStackId);
+ focusedStack = mAm.getFocusedStackInfo();
} catch (RemoteException e) {
Log.e(CarLog.TAG_AM, "cannot getFocusedStackId", e);
return null;