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

Commit c41f52c3 authored by Harshit Mahajan's avatar Harshit Mahajan Committed by Gerrit Code Review
Browse files

Merge "Refactoring recovery related code" into main

parents 71a82818 8024a3af
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -151,7 +151,7 @@ public abstract class ExplicitHealthCheckService extends Service {
     */
    @NonNull public abstract List<String> onGetRequestedPackages();

    private final Handler mHandler = new Handler(Looper.getMainLooper(), null, true);
    private final Handler mHandler = Handler.createAsync(Looper.getMainLooper());
    @Nullable private RemoteCallback mCallback;

    @Override
+1 −1
Original line number Diff line number Diff line
@@ -343,7 +343,7 @@ class ExplicitHealthCheckController {
            };

            mContext.bindServiceAsUser(intent, mConnection,
                    Context.BIND_AUTO_CREATE, UserHandle.of(UserHandle.USER_SYSTEM));
                    Context.BIND_AUTO_CREATE, UserHandle.SYSTEM);
            Slog.i(TAG, "Explicit health check service is bound");
        }
    }
+5 −3
Original line number Diff line number Diff line
@@ -500,7 +500,8 @@ public class RescueParty {
        Exception res = null;
        final ContentResolver resolver = context.getContentResolver();
        try {
            Settings.Global.resetToDefaultsAsUser(resolver, null, mode, UserHandle.USER_SYSTEM);
            Settings.Global.resetToDefaultsAsUser(resolver, null, mode,
                UserHandle.SYSTEM.getIdentifier());
        } catch (Exception e) {
            res = new RuntimeException("Failed to reset global settings", e);
        }
@@ -741,12 +742,13 @@ public class RescueParty {
    }

    private static int[] getAllUserIds() {
        int[] userIds = { UserHandle.USER_SYSTEM };
        int systemUserId = UserHandle.SYSTEM.getIdentifier();
        int[] userIds = { systemUserId };
        try {
            for (File file : FileUtils.listFilesOrEmpty(Environment.getDataSystemDeDirectory())) {
                try {
                    final int userId = Integer.parseInt(file.getName());
                    if (userId != UserHandle.USER_SYSTEM) {
                    if (userId != systemUserId) {
                        userIds = ArrayUtils.appendInt(userIds, userId);
                    }
                } catch (NumberFormatException ignored) {