Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c53962d4 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

When system server goes down, crash apps more.

Apps making calls into the system server may end up persisting
internal state or making security decisions based on the perceived
success or failure of a call, or the default values returned.

The reality is that if the system process just died, init will be
along shortly to kill all running apps, so we should have no problem
rethrowing the RemoteException as a RuntimeException.

Bug: 27364859
Change-Id: Ife0bcb079636c88d54c44d17eb580409fd79028b
parent f7d47f91
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -201,6 +201,7 @@ public class AlarmManager {
            try {
                mService.remove(null, this);
            } catch (RemoteException ex) {
                throw ex.rethrowFromSystemServer();
            }

            synchronized (AlarmManager.class) {
@@ -656,6 +657,7 @@ public class AlarmManager {
            mService.set(mPackageName, type, triggerAtMillis, windowMillis, intervalMillis, flags,
                    operation, recipientWrapper, listenerTag, workSource, alarmClock);
        } catch (RemoteException ex) {
            throw ex.rethrowFromSystemServer();
        }
    }

@@ -886,6 +888,7 @@ public class AlarmManager {
        try {
            mService.remove(operation, null);
        } catch (RemoteException ex) {
            throw ex.rethrowFromSystemServer();
        }
    }

@@ -926,6 +929,7 @@ public class AlarmManager {
        try {
            mService.setTime(millis);
        } catch (RemoteException ex) {
            throw ex.rethrowFromSystemServer();
        }
    }

@@ -965,6 +969,7 @@ public class AlarmManager {
        try {
            mService.setTimeZone(timeZone);
        } catch (RemoteException ex) {
            throw ex.rethrowFromSystemServer();
        }
    }

@@ -973,7 +978,7 @@ public class AlarmManager {
        try {
            return mService.getNextWakeFromIdleTime();
        } catch (RemoteException ex) {
            return Long.MAX_VALUE;
            throw ex.rethrowFromSystemServer();
        }
    }

@@ -1005,7 +1010,7 @@ public class AlarmManager {
        try {
            return mService.getNextAlarmClock(userId);
        } catch (RemoteException ex) {
            return null;
            throw ex.rethrowFromSystemServer();
        }
    }

+3 −5
Original line number Diff line number Diff line
@@ -890,9 +890,8 @@ public class NotificationManager
            final List<StatusBarNotification> list = parceledList.getList();
            return list.toArray(new StatusBarNotification[list.size()]);
        } catch (RemoteException e) {
            Log.e(TAG, "Unable to talk to notification manager. Woe!", e);
            throw e.rethrowFromSystemServer();
        }
        return new StatusBarNotification[0];
    }

    /**
@@ -913,9 +912,8 @@ public class NotificationManager
        try {
            return zenModeToInterruptionFilter(service.getZenMode());
        } catch (RemoteException e) {
            Log.e(TAG, "Unable to talk to notification manager. Woe!", e);
            throw e.rethrowFromSystemServer();
        }
        return INTERRUPTION_FILTER_UNKNOWN;
    }

    /**
@@ -936,7 +934,7 @@ public class NotificationManager
        try {
            service.setInterruptionFilter(mContext.getOpPackageName(), interruptionFilter);
        } catch (RemoteException e) {
            Log.e(TAG, "Unable to talk to notification manager. Woe!", e);
            throw e.rethrowFromSystemServer();
        }
    }

+8 −15
Original line number Diff line number Diff line
@@ -686,8 +686,7 @@ public class SearchManager
        try {
            return mService.getGlobalSearchActivities();
        } catch (RemoteException ex) {
            Log.e(TAG, "getGlobalSearchActivities() failed: " + ex);
            return null;
            throw ex.rethrowFromSystemServer();
        }
    }

@@ -698,8 +697,7 @@ public class SearchManager
        try {
            return mService.getGlobalSearchActivity();
        } catch (RemoteException ex) {
            Log.e(TAG, "getGlobalSearchActivity() failed: " + ex);
            return null;
            throw ex.rethrowFromSystemServer();
        }
    }

@@ -716,8 +714,7 @@ public class SearchManager
        try {
            return mService.getWebSearchActivity();
        } catch (RemoteException ex) {
            Log.e(TAG, "getWebSearchActivity() failed: " + ex);
            return null;
            throw ex.rethrowFromSystemServer();
        }
    }

@@ -850,8 +847,7 @@ public class SearchManager
        try {
            return mService.getSearchableInfo(componentName);
        } catch (RemoteException ex) {
            Log.e(TAG, "getSearchableInfo() failed: " + ex);
            return null;
            throw ex.rethrowFromSystemServer();
        }
    }

@@ -935,8 +931,7 @@ public class SearchManager
        try {
            return mService.getSearchablesInGlobalSearch();
        } catch (RemoteException e) {
            Log.e(TAG, "getSearchablesInGlobalSearch() failed: " + e);
            return null;
            throw e.rethrowFromSystemServer();
        }
    }

@@ -958,8 +953,7 @@ public class SearchManager
            }
            return intent;
        } catch (RemoteException re) {
            Log.e(TAG, "getAssistIntent() failed: " + re);
            return null;
            throw re.rethrowFromSystemServer();
        }
    }

@@ -977,7 +971,7 @@ public class SearchManager
            }
            mService.launchAssist(args);
        } catch (RemoteException re) {
            Log.e(TAG, "launchAssist() failed: " + re);
            throw re.rethrowFromSystemServer();
        }
    }

@@ -995,8 +989,7 @@ public class SearchManager
            }
            return mService.launchLegacyAssist(hint, userHandle, args);
        } catch (RemoteException re) {
            Log.e(TAG, "launchAssist() failed: " + re);
            return false;
            throw re.rethrowFromSystemServer();
        }
    }
}
+8 −16
Original line number Diff line number Diff line
@@ -123,8 +123,7 @@ public class StatusBarManager {
                svc.disable(what, mToken, mContext.getPackageName());
            }
        } catch (RemoteException ex) {
            // system process is dead anyway.
            throw new RuntimeException(ex);
            throw ex.rethrowFromSystemServer();
        }
    }

@@ -141,8 +140,7 @@ public class StatusBarManager {
                svc.disable2(what, mToken, mContext.getPackageName());
            }
        } catch (RemoteException ex) {
            // system process is dead anyway.
            throw new RuntimeException(ex);
            throw ex.rethrowFromSystemServer();
        }
    }

@@ -156,8 +154,7 @@ public class StatusBarManager {
                svc.expandNotificationsPanel();
            }
        } catch (RemoteException ex) {
            // system process is dead anyway.
            throw new RuntimeException(ex);
            throw ex.rethrowFromSystemServer();
        }
    }
    
@@ -171,8 +168,7 @@ public class StatusBarManager {
                svc.collapsePanels();
            }
        } catch (RemoteException ex) {
            // system process is dead anyway.
            throw new RuntimeException(ex);
            throw ex.rethrowFromSystemServer();
        }
    }

@@ -193,8 +189,7 @@ public class StatusBarManager {
                svc.expandSettingsPanel(subPanel);
            }
        } catch (RemoteException ex) {
            // system process is dead anyway.
            throw new RuntimeException(ex);
            throw ex.rethrowFromSystemServer();
        }
    }

@@ -206,8 +201,7 @@ public class StatusBarManager {
                    contentDescription);
            }
        } catch (RemoteException ex) {
            // system process is dead anyway.
            throw new RuntimeException(ex);
            throw ex.rethrowFromSystemServer();
        }
    }

@@ -218,8 +212,7 @@ public class StatusBarManager {
                svc.removeIcon(slot);
            }
        } catch (RemoteException ex) {
            // system process is dead anyway.
            throw new RuntimeException(ex);
            throw ex.rethrowFromSystemServer();
        }
    }

@@ -230,8 +223,7 @@ public class StatusBarManager {
                svc.setIconVisibility(slot, visible);
            }
        } catch (RemoteException ex) {
            // system process is dead anyway.
            throw new RuntimeException(ex);
            throw ex.rethrowFromSystemServer();
        }
    }

+7 −7
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ public class UiModeManager {
            try {
                mService.enableCarMode(flags);
            } catch (RemoteException e) {
                Log.e(TAG, "disableCarMode: RemoteException", e);
                throw e.rethrowFromSystemServer();
            }
        }
    }
@@ -181,7 +181,7 @@ public class UiModeManager {
            try {
                mService.disableCarMode(flags);
            } catch (RemoteException e) {
                Log.e(TAG, "disableCarMode: RemoteException", e);
                throw e.rethrowFromSystemServer();
            }
        }
    }
@@ -200,7 +200,7 @@ public class UiModeManager {
            try {
                return mService.getCurrentModeType();
            } catch (RemoteException e) {
                Log.e(TAG, "getCurrentModeType: RemoteException", e);
                throw e.rethrowFromSystemServer();
            }
        }
        return Configuration.UI_MODE_TYPE_NORMAL;
@@ -233,7 +233,7 @@ public class UiModeManager {
            try {
                mService.setNightMode(mode);
            } catch (RemoteException e) {
                Log.e(TAG, "setNightMode: RemoteException", e);
                throw e.rethrowFromSystemServer();
            }
        }
    }
@@ -257,7 +257,7 @@ public class UiModeManager {
            try {
                return mService.getNightMode();
            } catch (RemoteException e) {
                Log.e(TAG, "getNightMode: RemoteException", e);
                throw e.rethrowFromSystemServer();
            }
        }
        return -1;
@@ -272,7 +272,7 @@ public class UiModeManager {
            try {
                return mService.isUiModeLocked();
            } catch (RemoteException e) {
                Log.e(TAG, "isUiModeLocked: RemoteException", e);
                throw e.rethrowFromSystemServer();
            }
        }
        return true;
@@ -292,7 +292,7 @@ public class UiModeManager {
            try {
                return mService.isNightModeLocked();
            } catch (RemoteException e) {
                Log.e(TAG, "isNightModeLocked: RemoteException", e);
                throw e.rethrowFromSystemServer();
            }
        }
        return true;
Loading