diff options
author | Michael Hoisie <hoisie@google.com> | 2022-02-10 14:25:21 -0800 |
---|---|---|
committer | Michael Hoisie <hoisie@google.com> | 2022-02-10 22:30:26 +0000 |
commit | 75f96b92ba8ae3d904d281b3643b6a0a2436c9c0 (patch) | |
tree | 91fd8bf228b2c460835f9486141d0d27e4ec72be | |
parent | 0a5e63baae1f8d470ec1ce481ca525e97c579995 (diff) | |
download | robolectric-shadows-75f96b92ba8ae3d904d281b3643b6a0a2436c9c0.tar.gz |
Update ShadowActivityThread to support SDK < T
This makes ShadowActivityThread indifferent to the flags type.
Flags is an Integer in SDK < T and a Long in SDK >= T. Using
Number works for both cases.
Bug: 208941075
Bug: 214489331
Test: Runclockwork-ambient-robotests
Change-Id: I8c9d62fda3811578b7e1c774be7a3ae66d4fc72c
-rw-r--r-- | shadows/framework/src/main/java/org/robolectric/shadows/ShadowActivityThread.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowActivityThread.java b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowActivityThread.java index 31e2a46ec..829151728 100644 --- a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowActivityThread.java +++ b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowActivityThread.java @@ -42,7 +42,7 @@ public class ShadowActivityThread { throws Exception { if (method.getName().equals("getApplicationInfo")) { String packageName = (String) args[0]; - int flags = ((Long) args[1]).intValue(); + int flags = ((Number) args[1]).intValue(); if (packageName.equals(ShadowActivityThread.applicationInfo.packageName)) { return ShadowActivityThread.applicationInfo; @@ -57,7 +57,7 @@ public class ShadowActivityThread { } } else if (method.getName().equals("getActivityInfo")) { ComponentName className = (ComponentName) args[0]; - int flags = ((Long) args[1]).intValue(); + int flags = ((Number) args[1]).intValue(); try { return RuntimeEnvironment.application @@ -68,7 +68,7 @@ public class ShadowActivityThread { } } else if (method.getName().equals("getServiceInfo")) { ComponentName className = (ComponentName) args[0]; - int flags = ((Long) args[1]).intValue(); + int flags = ((Number) args[1]).intValue(); try { return RuntimeEnvironment.application @@ -78,7 +78,7 @@ public class ShadowActivityThread { throw new RemoteException(e.getMessage()); } } else if (method.getName().equals("getInstalledApplications")) { - int flags = ((Long) args[0]).intValue(); + int flags = ((Number) args[0]).intValue(); int userId = (Integer) args[1]; return new ParceledListSlice<>( RuntimeEnvironment.application |