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

Commit 1b708e68 authored by Tony Mak's avatar Tony Mak
Browse files

Introduce CrossProfileApps API

CTS will be in next CL.
APIs for labels/ icons of profile switching are not implemented yet.

Test: Wrote a test app to play around the APIs
Test: bit FrameworksServicesTests:com.android.server.pm.crossprofile.CrossProfileAppsServiceImplTest
BUG: 67765768

Change-Id: I27714aa4a8d61c6df398cbc5112cb4c35316a3fb
parent 378f389b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -158,6 +158,7 @@ LOCAL_SRC_FILES += \
	core/java/android/content/ISyncServiceAdapter.aidl \
	core/java/android/content/ISyncStatusObserver.aidl \
	core/java/android/content/om/IOverlayManager.aidl \
	core/java/android/content/pm/crossprofile/ICrossProfileApps.aidl \
	core/java/android/content/pm/IDexModuleRegisterCallback.aidl \
	core/java/android/content/pm/ILauncherApps.aidl \
	core/java/android/content/pm/IOnAppsChangedListener.aidl \
+10 −0
Original line number Diff line number Diff line
@@ -9100,6 +9100,7 @@ package android.content {
    field public static final int CONTEXT_IGNORE_SECURITY = 2; // 0x2
    field public static final int CONTEXT_INCLUDE_CODE = 1; // 0x1
    field public static final int CONTEXT_RESTRICTED = 4; // 0x4
    field public static final java.lang.String CROSS_PROFILE_APPS_SERVICE = "crossprofileapps";
    field public static final java.lang.String DEVICE_POLICY_SERVICE = "device_policy";
    field public static final java.lang.String DISPLAY_SERVICE = "display";
    field public static final java.lang.String DOWNLOAD_SERVICE = "download";
@@ -11221,6 +11222,15 @@ package android.content.pm {
}
package android.content.pm.crossprofile {
  public class CrossProfileApps {
    method public java.util.List<android.os.UserHandle> getTargetUserProfiles();
    method public void startMainActivity(android.content.ComponentName, android.os.UserHandle, android.graphics.Rect, android.os.Bundle);
  }
}
package android.content.res {
  public class AssetFileDescriptor implements java.io.Closeable android.os.Parcelable {
+10 −0
Original line number Diff line number Diff line
@@ -9619,6 +9619,7 @@ package android.content {
    field public static final int CONTEXT_IGNORE_SECURITY = 2; // 0x2
    field public static final int CONTEXT_INCLUDE_CODE = 1; // 0x1
    field public static final int CONTEXT_RESTRICTED = 4; // 0x4
    field public static final java.lang.String CROSS_PROFILE_APPS_SERVICE = "crossprofileapps";
    field public static final java.lang.String DEVICE_POLICY_SERVICE = "device_policy";
    field public static final java.lang.String DISPLAY_SERVICE = "display";
    field public static final java.lang.String DOWNLOAD_SERVICE = "download";
@@ -11951,6 +11952,15 @@ package android.content.pm {
}
package android.content.pm.crossprofile {
  public class CrossProfileApps {
    method public java.util.List<android.os.UserHandle> getTargetUserProfiles();
    method public void startMainActivity(android.content.ComponentName, android.os.UserHandle, android.graphics.Rect, android.os.Bundle);
  }
}
package android.content.pm.permission {
  public final class RuntimePermissionPresentationInfo implements android.os.Parcelable {
+10 −0
Original line number Diff line number Diff line
@@ -9174,6 +9174,7 @@ package android.content {
    field public static final int CONTEXT_IGNORE_SECURITY = 2; // 0x2
    field public static final int CONTEXT_INCLUDE_CODE = 1; // 0x1
    field public static final int CONTEXT_RESTRICTED = 4; // 0x4
    field public static final java.lang.String CROSS_PROFILE_APPS_SERVICE = "crossprofileapps";
    field public static final java.lang.String DEVICE_POLICY_SERVICE = "device_policy";
    field public static final java.lang.String DISPLAY_SERVICE = "display";
    field public static final java.lang.String DOWNLOAD_SERVICE = "download";
@@ -11307,6 +11308,15 @@ package android.content.pm {
}
package android.content.pm.crossprofile {
  public class CrossProfileApps {
    method public java.util.List<android.os.UserHandle> getTargetUserProfiles();
    method public void startMainActivity(android.content.ComponentName, android.os.UserHandle, android.graphics.Rect, android.os.Bundle);
  }
}
package android.content.res {
  public class AssetFileDescriptor implements java.io.Closeable android.os.Parcelable {
+14 −0
Original line number Diff line number Diff line
@@ -41,6 +41,8 @@ import android.content.pm.IShortcutService;
import android.content.pm.LauncherApps;
import android.content.pm.PackageManager;
import android.content.pm.ShortcutManager;
import android.content.pm.crossprofile.CrossProfileApps;
import android.content.pm.crossprofile.ICrossProfileApps;
import android.content.res.Resources;
import android.hardware.ConsumerIrManager;
import android.hardware.ISerialManager;
@@ -909,6 +911,18 @@ final class SystemServiceRegistry {
            public RulesManager createService(ContextImpl ctx) {
                return new RulesManager(ctx.getOuterContext());
            }});

        registerService(Context.CROSS_PROFILE_APPS_SERVICE, CrossProfileApps.class,
                new CachedServiceFetcher<CrossProfileApps>() {
                    @Override
                    public CrossProfileApps createService(ContextImpl ctx)
                            throws ServiceNotFoundException {
                        IBinder b = ServiceManager.getServiceOrThrow(
                                Context.CROSS_PROFILE_APPS_SERVICE);
                        return new CrossProfileApps(ctx.getOuterContext(),
                                ICrossProfileApps.Stub.asInterface(b));
                    }
                });
    }

    /**
Loading