summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorFabian Kozynski <kozynski@google.com>2022-04-11 14:10:21 -0400
committerFabian Kozynski <kozynski@google.com>2022-04-11 14:10:21 -0400
commit0549cf1251869cbfca200e12f8e1aa5deee4facb (patch)
treea61210e81e061af3b6c5efa21fbd92ce1e507829 /core/java/android
parent3fda2bf279c1a354e069a10929e2a87908703032 (diff)
Don't crash TileService app when systemui crashes
Prevent the host app from crashing if systemui crashes while binding to it. Instead, just return null and let the new systemui process bind again, as the service will be unbound. Test: atest FrameworksCoreTests:TileServiceTest Test: manual, tiles still work Fixes: 168756844 Change-Id: I70e0e8a223a84874415f7e649106398a5e039097
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/service/quicksettings/TileService.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/java/android/service/quicksettings/TileService.java b/core/java/android/service/quicksettings/TileService.java
index 0829d2813c83..85502197ea7e 100644
--- a/core/java/android/service/quicksettings/TileService.java
+++ b/core/java/android/service/quicksettings/TileService.java
@@ -353,7 +353,13 @@ public class TileService extends Service {
try {
mTile = mService.getTile(mTileToken);
} catch (RemoteException e) {
- throw new RuntimeException("Unable to reach IQSService", e);
+ String name = TileService.this.getClass().getSimpleName();
+ Log.w(TAG, name + " - Couldn't get tile from IQSService.", e);
+ // If we couldn't receive the tile, there's not much reason to continue as users won't
+ // be able to interact. Returning `null` will trigger an unbind in SystemUI and
+ // eventually we'll rebind when needed. This usually means that SystemUI crashed
+ // right after binding and therefore `mService` is outdated.
+ return null;
}
if (mTile != null) {
mTile.setService(mService, mTileToken);