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

Commit 8d324d51 authored by Hardik Goyal's avatar Hardik Goyal
Browse files

Setup skeleton of userrecoveryManagerService

This commit is to create a skeleton of new UserRecoveryManagerService as a platform Service.
The skeleton includes:

*   Aconfig flag `enable_user_recovery_manager` to be able to disable this service.
*   A new service that has a stub for IPC `IUserRecoveryManager.aidl` and a client side `UserRecoveryManager.java`
*  register the `UserRecoveryManagerService` in the systemServer

Bug: 415960504
Flag: android.app.userrecovery.flags.enable_user_recovery_manager
Test: Build the code and see that `enable_user_recovery_manager` works as expected and the service is started.
Change-Id: Ieb8819806c80bb7b432d7a7d2c9e4549cdf8219b
parent ab7158a3
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ aconfig_declarations_group {
        "android.app.flags-aconfig-java",
        "android.app.jank.flags-aconfig-java",
        "android.app.ondeviceintelligence-aconfig-java",
        "android.app.userrecovery.flags-aconfig-java",
        "android.app.smartspace.flags-aconfig-java",
        "android.app.supervision.flags-aconfig-java",
        "android.app.usage.flags-aconfig-java",
@@ -1297,6 +1298,21 @@ aconfig_declarations {
    visibility: [":__subpackages__"],
}

// User Recovery
aconfig_declarations {
    name: "android.app.userrecovery.flags-aconfig",
    exportable: true,
    package: "android.app.userrecovery.flags",
    container: "system",
    srcs: ["core/java/android/app/userrecovery/flags/flags.aconfig"],
}

java_aconfig_library {
    name: "android.app.userrecovery.flags-aconfig-java",
    aconfig_declarations: "android.app.userrecovery.flags-aconfig",
    defaults: ["framework-minus-apex-aconfig-java-defaults"],
}

// Thread network
aconfig_declarations {
    name: "com.android.net.thread.platform.flags-aconfig",
+19 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.app;

import static android.app.appfunctions.flags.Flags.enableAppFunctionManager;
import static android.app.userrecovery.flags.Flags.enableUserRecoveryManager;
import static android.hardware.serial.flags.Flags.enableSerialApi;
import static android.provider.flags.Flags.newStoragePublicApi;
import static android.server.Flags.removeGameManagerServiceFromWear;
@@ -64,6 +65,8 @@ import android.app.usage.IStorageStatsManager;
import android.app.usage.IUsageStatsManager;
import android.app.usage.StorageStatsManager;
import android.app.usage.UsageStatsManager;
import android.app.userrecovery.IUserRecoveryManager;
import android.app.userrecovery.UserRecoveryManager;
import android.app.wallpapereffectsgeneration.IWallpaperEffectsGenerationManager;
import android.app.wallpapereffectsgeneration.WallpaperEffectsGenerationManager;
import android.app.wearable.IWearableSensingManager;
@@ -973,6 +976,22 @@ public final class SystemServiceRegistry {
                    });
        }

      if (enableUserRecoveryManager()) {
            registerService(Context.USER_RECOVERY_SERVICE, UserRecoveryManager.class,
                    new CachedServiceFetcher<>() {
                        @Override
                        public UserRecoveryManager createService(ContextImpl ctx)
                                throws ServiceNotFoundException {
                                    IUserRecoveryManager service;
                            service = IUserRecoveryManager.Stub.asInterface(
                                    ServiceManager.getServiceOrThrow(
                                        Context.USER_RECOVERY_SERVICE));
                            return new UserRecoveryManager(service, ctx.getOuterContext());
                        }
                    });
        }


        registerService(Context.VIRTUAL_DEVICE_SERVICE, VirtualDeviceManager.class,
                new CachedServiceFetcher<VirtualDeviceManager>() {
            @Override
+24 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.app.userrecovery;

/**
* Interface between an app and the server implementation service (UserRecoveryManagerService).
* @hide
*/
oneway interface IUserRecoveryManager {
}
+3 −0
Original line number Diff line number Diff line
behnoodm@google.com
hardikgoyal@google.com
jadmanski@google.com
+47 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.app.userrecovery;

import static android.app.userrecovery.flags.Flags.FLAG_ENABLE_USER_RECOVERY_MANAGER;

import android.annotation.FlaggedApi;
import android.annotation.SystemService;
import android.content.Context;

/**
 * Provides user recovery related functionalities.
 *
 * @hide
 */
@FlaggedApi(FLAG_ENABLE_USER_RECOVERY_MANAGER)
@SystemService(Context.USER_RECOVERY_SERVICE)
public final class UserRecoveryManager {
    @SuppressWarnings("unused")
    private final IUserRecoveryManager mService;
    @SuppressWarnings("unused")
    private final Context mContext;

    /**
     * TODO(b/415960504): add comments when implementing this class
     *
     * @hide
     */
    public UserRecoveryManager(IUserRecoveryManager mService, Context context) {
        this.mService = mService;
        this.mContext = context;
    }
}
Loading