Move ALLOW_COMMUNAL_MODE_* constants into CommunalManager.java.

Test: atest FrameworksMockingServicesTests:CommunalManagerServiceTest

Bug: 198325535
Change-Id: Iebd18230b1a4d25a5c5c186337cb0019944e6c0f
This commit is contained in:
Xiaowen Lei
2021-11-09 03:03:48 +00:00
parent 511be9a373
commit 3bb6b5e717
3 changed files with 27 additions and 28 deletions

View File

@@ -19,6 +19,9 @@ package android.app.communal;
import android.Manifest;
import android.annotation.RequiresPermission;
import android.annotation.SystemService;
import android.compat.annotation.ChangeId;
import android.compat.annotation.Disabled;
import android.compat.annotation.Overridable;
import android.content.Context;
import android.os.RemoteException;
@@ -32,6 +35,27 @@ import android.os.RemoteException;
public final class CommunalManager {
private final ICommunalManager mService;
/**
* This change id is used to annotate packages which can run in communal mode by default,
* without requiring user opt-in.
*
* @hide
*/
@ChangeId
@Overridable
@Disabled
public static final long ALLOW_COMMUNAL_MODE_BY_DEFAULT = 203673428L;
/**
* This change id is used to annotate packages which are allowed to run in communal mode.
*
* @hide
*/
@ChangeId
@Overridable
@Disabled
public static final long ALLOW_COMMUNAL_MODE_WITH_USER_CONSENT = 200324021L;
public CommunalManager(ICommunalManager service) {
mService = service;
}

View File

@@ -17,6 +17,8 @@
package com.android.server.communal;
import static android.app.ActivityManager.INTENT_SENDER_ACTIVITY;
import static android.app.communal.CommunalManager.ALLOW_COMMUNAL_MODE_BY_DEFAULT;
import static android.app.communal.CommunalManager.ALLOW_COMMUNAL_MODE_WITH_USER_CONSENT;
import static android.content.Intent.ACTION_PACKAGE_REMOVED;
import static com.android.server.wm.ActivityInterceptorCallback.COMMUNAL_MODE_ORDERED_ID;
@@ -25,14 +27,10 @@ import android.Manifest;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.TestApi;
import android.app.KeyguardManager;
import android.app.PendingIntent;
import android.app.communal.ICommunalManager;
import android.app.compat.CompatChanges;
import android.compat.annotation.ChangeId;
import android.compat.annotation.Disabled;
import android.compat.annotation.Overridable;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
@@ -80,29 +78,6 @@ public final class CommunalManagerService extends SystemService {
private final PackageManager mPackageManager;
private final DreamManagerInternal mDreamManagerInternal;
/**
* This change id is used to annotate packages which are allowed to run in communal mode.
*
* @hide
*/
@ChangeId
@Overridable
@Disabled
@TestApi
public static final long ALLOW_COMMUNAL_MODE_WITH_USER_CONSENT = 200324021L;
/**
* This change id is used to annotate packages which can run in communal mode by default,
* without requiring user opt-in.
*
* @hide
*/
@ChangeId
@Overridable
@Disabled
@TestApi
public static final long ALLOW_COMMUNAL_MODE_BY_DEFAULT = 203673428L;
private final ActivityInterceptorCallback mActivityInterceptorCallback =
new ActivityInterceptorCallback() {
@Nullable

View File

@@ -16,6 +16,7 @@
package com.android.server.communal;
import static android.app.communal.CommunalManager.ALLOW_COMMUNAL_MODE_WITH_USER_CONSENT;
import static android.content.Intent.ACTION_PACKAGE_REMOVED;
import static android.content.pm.ActivityInfo.FLAG_SHOW_WHEN_LOCKED;
@@ -23,7 +24,6 @@ import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.mockitoSession;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.when;
import static com.android.server.communal.CommunalManagerService.ALLOW_COMMUNAL_MODE_WITH_USER_CONSENT;
import static com.android.server.wm.ActivityInterceptorCallback.COMMUNAL_MODE_ORDERED_ID;
import static com.google.common.truth.Truth.assertThat;