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

Commit 49607029 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "When system server goes down, crash apps." into nyc-dev

parents 1a2cb453 27b2e697
Loading
Loading
Loading
Loading
+52 −61
Original line number Diff line number Diff line
@@ -716,8 +716,7 @@ public class ActivityManager {
        try {
            return ActivityManagerNative.getDefault().getFrontActivityScreenCompatMode();
        } catch (RemoteException e) {
            // System dead, we will be dead too soon!
            return 0;
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -726,7 +725,7 @@ public class ActivityManager {
        try {
            ActivityManagerNative.getDefault().setFrontActivityScreenCompatMode(mode);
        } catch (RemoteException e) {
            // System dead, we will be dead too soon!
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -735,8 +734,7 @@ public class ActivityManager {
        try {
            return ActivityManagerNative.getDefault().getPackageScreenCompatMode(packageName);
        } catch (RemoteException e) {
            // System dead, we will be dead too soon!
            return 0;
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -745,7 +743,7 @@ public class ActivityManager {
        try {
            ActivityManagerNative.getDefault().setPackageScreenCompatMode(packageName, mode);
        } catch (RemoteException e) {
            // System dead, we will be dead too soon!
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -754,8 +752,7 @@ public class ActivityManager {
        try {
            return ActivityManagerNative.getDefault().getPackageAskScreenCompat(packageName);
        } catch (RemoteException e) {
            // System dead, we will be dead too soon!
            return false;
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -764,7 +761,7 @@ public class ActivityManager {
        try {
            ActivityManagerNative.getDefault().setPackageAskScreenCompat(packageName, ask);
        } catch (RemoteException e) {
            // System dead, we will be dead too soon!
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -1049,6 +1046,7 @@ public class ActivityManager {
                    return ActivityManagerNative.getDefault().getTaskDescriptionIcon(iconFilename,
                            userId);
                } catch (RemoteException e) {
                    throw e.rethrowAsRuntimeException();
                }
            }
            return null;
@@ -1429,8 +1427,7 @@ public class ActivityManager {
            return ActivityManagerNative.getDefault().getRecentTasks(maxNum,
                    flags, UserHandle.myUserId());
        } catch (RemoteException e) {
            // System dead, we will be dead too soon!
            return null;
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -1455,8 +1452,7 @@ public class ActivityManager {
            return ActivityManagerNative.getDefault().getRecentTasks(maxNum,
                    flags, userId);
        } catch (RemoteException e) {
            // System dead, we will be dead too soon!
            return null;
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -1591,8 +1587,7 @@ public class ActivityManager {
        try {
            appTasks = ActivityManagerNative.getDefault().getAppTasks(mContext.getPackageName());
        } catch (RemoteException e) {
            // System dead, we will be dead too soon!
            return null;
            throw e.rethrowAsRuntimeException();
        }
        int numAppTasks = appTasks.size();
        for (int i = 0; i < numAppTasks; i++) {
@@ -1617,7 +1612,7 @@ public class ActivityManager {
            try {
                mAppTaskThumbnailSize = ActivityManagerNative.getDefault().getAppTaskThumbnailSize();
            } catch (RemoteException e) {
                throw new IllegalStateException("System dead?", e);
                throw e.rethrowAsRuntimeException();
            }
        }
    }
@@ -1683,7 +1678,7 @@ public class ActivityManager {
            return ActivityManagerNative.getDefault().addAppTask(activity.getActivityToken(),
                    intent, description, thumbnail);
        } catch (RemoteException e) {
            throw new IllegalStateException("System dead?", e);
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -1725,8 +1720,7 @@ public class ActivityManager {
        try {
            return ActivityManagerNative.getDefault().getTasks(maxNum, 0);
        } catch (RemoteException e) {
            // System dead, we will be dead too soon!
            return null;
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -1742,8 +1736,7 @@ public class ActivityManager {
        try {
            return ActivityManagerNative.getDefault().removeTask(taskId);
        } catch (RemoteException e) {
            // System dead, we will be dead too soon!
            return false;
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -1902,8 +1895,7 @@ public class ActivityManager {
        try {
            return ActivityManagerNative.getDefault().getTaskThumbnail(id);
        } catch (RemoteException e) {
            // System dead, we will be dead too soon!
            return null;
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -1912,8 +1904,7 @@ public class ActivityManager {
        try {
            return ActivityManagerNative.getDefault().isInHomeStack(taskId);
        } catch (RemoteException e) {
            // System dead, we will be dead too soon!
            return false;
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -1962,7 +1953,7 @@ public class ActivityManager {
        try {
            ActivityManagerNative.getDefault().moveTaskToFront(taskId, flags, options);
        } catch (RemoteException e) {
            // System dead, we will be dead too soon!
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -2148,8 +2139,7 @@ public class ActivityManager {
            return ActivityManagerNative.getDefault()
                    .getServices(maxNum, 0);
        } catch (RemoteException e) {
            // System dead, we will be dead too soon!
            return null;
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -2164,8 +2154,7 @@ public class ActivityManager {
            return ActivityManagerNative.getDefault()
                    .getRunningServiceControlPanel(service);
        } catch (RemoteException e) {
            // System dead, we will be dead too soon!
            return null;
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -2269,6 +2258,7 @@ public class ActivityManager {
        try {
            ActivityManagerNative.getDefault().getMemoryInfo(outInfo);
        } catch (RemoteException e) {
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -2387,7 +2377,7 @@ public class ActivityManager {
            return ActivityManagerNative.getDefault().clearApplicationUserData(packageName,
                    observer, UserHandle.myUserId());
        } catch (RemoteException e) {
            return false;
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -2421,8 +2411,7 @@ public class ActivityManager {
            return ActivityManagerNative.getDefault().getGrantedUriPermissions(packageName,
                    UserHandle.myUserId());
        } catch (RemoteException e) {
            Log.e(TAG, "Couldn't get granted URI permissions for :" + packageName, e);
            return ParceledListSlice.emptyList();
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -2440,7 +2429,7 @@ public class ActivityManager {
            ActivityManagerNative.getDefault().clearGrantedUriPermissions(packageName,
                    UserHandle.myUserId());
        } catch (RemoteException e) {
            Log.e(TAG, "Couldn't clear granted URI permissions for :" + packageName, e);
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -2560,7 +2549,7 @@ public class ActivityManager {
        try {
            return ActivityManagerNative.getDefault().getProcessesInErrorState();
        } catch (RemoteException e) {
            return null;
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -2874,7 +2863,7 @@ public class ActivityManager {
        try {
            return ActivityManagerNative.getDefault().getRunningExternalApplications();
        } catch (RemoteException e) {
            return null;
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -2891,7 +2880,7 @@ public class ActivityManager {
            return ActivityManagerNative.getDefault().setProcessMemoryTrimLevel(process, userId,
                    level);
        } catch (RemoteException e) {
            return false;
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -2909,7 +2898,7 @@ public class ActivityManager {
        try {
            return ActivityManagerNative.getDefault().getRunningAppProcesses();
        } catch (RemoteException e) {
            return null;
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -2928,7 +2917,7 @@ public class ActivityManager {
                    mContext.getOpPackageName());
            return RunningAppProcessInfo.procStateToImportance(procState);
        } catch (RemoteException e) {
            return RunningAppProcessInfo.IMPORTANCE_GONE;
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -2947,6 +2936,7 @@ public class ActivityManager {
        try {
            ActivityManagerNative.getDefault().getMyMemoryState(outState);
        } catch (RemoteException e) {
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -2965,7 +2955,7 @@ public class ActivityManager {
        try {
            return ActivityManagerNative.getDefault().getProcessMemoryInfo(pids);
        } catch (RemoteException e) {
            return null;
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -2999,6 +2989,7 @@ public class ActivityManager {
            ActivityManagerNative.getDefault().killBackgroundProcesses(packageName,
                    UserHandle.myUserId());
        } catch (RemoteException e) {
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -3015,7 +3006,7 @@ public class ActivityManager {
            ActivityManagerNative.getDefault().killUid(UserHandle.getAppId(uid),
                    UserHandle.getUserId(uid), reason);
        } catch (RemoteException e) {
            Log.e(TAG, "Couldn't kill uid:" + uid, e);
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -3042,6 +3033,7 @@ public class ActivityManager {
        try {
            ActivityManagerNative.getDefault().forceStopPackage(packageName, userId);
        } catch (RemoteException e) {
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -3060,8 +3052,8 @@ public class ActivityManager {
        try {
            return ActivityManagerNative.getDefault().getDeviceConfigurationInfo();
        } catch (RemoteException e) {
            throw e.rethrowAsRuntimeException();
        }
        return null;
    }

    /**
@@ -3150,8 +3142,8 @@ public class ActivityManager {
        try {
            return ActivityManagerNative.getDefault().isUserAMonkey();
        } catch (RemoteException e) {
            throw e.rethrowAsRuntimeException();
        }
        return false;
    }

    /**
@@ -3226,10 +3218,8 @@ public class ActivityManager {
            return AppGlobals.getPackageManager()
                    .checkUidPermission(permission, uid);
        } catch (RemoteException e) {
            // Should never happen, but if it does... deny!
            Slog.e(TAG, "PackageManager is dead?!?", e);
            throw e.rethrowAsRuntimeException();
        }
        return PackageManager.PERMISSION_DENIED;
    }

    /** @hide */
@@ -3238,10 +3228,8 @@ public class ActivityManager {
            return AppGlobals.getPackageManager()
                    .checkUidPermission(permission, uid);
        } catch (RemoteException e) {
            // Should never happen, but if it does... deny!
            Slog.e(TAG, "PackageManager is dead?!?", e);
            throw e.rethrowAsRuntimeException();
        }
        return PackageManager.PERMISSION_DENIED;
    }

    /**
@@ -3277,7 +3265,7 @@ public class ActivityManager {
            return ActivityManagerNative.getDefault().handleIncomingUser(callingPid,
                    callingUid, userId, allowAll, requireFull, name, callerPackage);
        } catch (RemoteException e) {
            throw new SecurityException("Failed calling activity manager", e);
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -3292,7 +3280,7 @@ public class ActivityManager {
            ui = ActivityManagerNative.getDefault().getCurrentUser();
            return ui != null ? ui.id : 0;
        } catch (RemoteException e) {
            return 0;
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -3304,7 +3292,7 @@ public class ActivityManager {
        try {
            return ActivityManagerNative.getDefault().switchUser(userid);
        } catch (RemoteException e) {
            return false;
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -3328,7 +3316,7 @@ public class ActivityManager {
        try {
            return ActivityManagerNative.getDefault().isUserRunning(userId, 0);
        } catch (RemoteException e) {
            return false;
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -3338,7 +3326,7 @@ public class ActivityManager {
            return ActivityManagerNative.getDefault().isUserRunning(userId,
                    ActivityManager.FLAG_AND_LOCKED);
        } catch (RemoteException e) {
            return false;
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -3348,7 +3336,7 @@ public class ActivityManager {
            return ActivityManagerNative.getDefault().isUserRunning(userId,
                    ActivityManager.FLAG_AND_UNLOCKED);
        } catch (RemoteException e) {
            return false;
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -3433,6 +3421,7 @@ public class ActivityManager {
            ActivityManagerNative.getDefault().setDumpHeapDebugLimit(null, 0, pssSize,
                    mContext.getPackageName());
        } catch (RemoteException e) {
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -3451,6 +3440,7 @@ public class ActivityManager {
        try {
            ActivityManagerNative.getDefault().setDumpHeapDebugLimit(null, 0, 0, null);
        } catch (RemoteException e) {
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -3461,6 +3451,7 @@ public class ActivityManager {
        try {
            ActivityManagerNative.getDefault().startLockTaskMode(taskId);
        } catch (RemoteException e) {
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -3471,6 +3462,7 @@ public class ActivityManager {
        try {
            ActivityManagerNative.getDefault().stopLockTaskMode();
        } catch (RemoteException e) {
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -3497,7 +3489,7 @@ public class ActivityManager {
        try {
            return ActivityManagerNative.getDefault().getLockTaskModeState();
        } catch (RemoteException e) {
            return ActivityManager.LOCK_TASK_MODE_NONE;
            throw e.rethrowAsRuntimeException();
        }
    }

@@ -3520,7 +3512,7 @@ public class ActivityManager {
            try {
                mAppTaskImpl.finishAndRemoveTask();
            } catch (RemoteException e) {
                Slog.e(TAG, "Invalid AppTask", e);
                throw e.rethrowAsRuntimeException();
            }
        }

@@ -3533,8 +3525,7 @@ public class ActivityManager {
            try {
                return mAppTaskImpl.getTaskInfo();
            } catch (RemoteException e) {
                Slog.e(TAG, "Invalid AppTask", e);
                return null;
                throw e.rethrowAsRuntimeException();
            }
        }

@@ -3548,7 +3539,7 @@ public class ActivityManager {
            try {
                mAppTaskImpl.moveToFront();
            } catch (RemoteException e) {
                Slog.e(TAG, "Invalid AppTask", e);
                throw e.rethrowAsRuntimeException();
            }
        }

@@ -3590,7 +3581,7 @@ public class ActivityManager {
            try {
                mAppTaskImpl.setExcludeFromRecents(exclude);
            } catch (RemoteException e) {
                Slog.e(TAG, "Invalid AppTask", e);
                throw e.rethrowAsRuntimeException();
            }
        }
    }