Snap for 11679388 from dd0c69f87f to 24Q3-release
Change-Id: I59b433082c1d530041176b61280a2fee3200e37a
This commit is contained in:
@@ -9834,13 +9834,6 @@
|
|||||||
<!-- Label for showing apps that can manage external storage[CHAR LIMIT=45] -->
|
<!-- Label for showing apps that can manage external storage[CHAR LIMIT=45] -->
|
||||||
<string name="filter_manage_external_storage">Can access all files</string>
|
<string name="filter_manage_external_storage">Can access all files</string>
|
||||||
|
|
||||||
<!-- Voice Activation apps settings title [CHAR LIMIT=40] -->
|
|
||||||
<string name="voice_activation_apps_title">Voice activation apps</string>
|
|
||||||
<!-- Label for a setting which controls whether an app can be voice activated [CHAR LIMIT=NONE] -->
|
|
||||||
<string name="permit_voice_activation_apps">Allow voice activation</string>
|
|
||||||
<!-- Description for a setting which controls whether an app can be voice activated [CHAR LIMIT=NONE] -->
|
|
||||||
<string name ="allow_voice_activation_apps_description">Voice activation turns-on approved apps, hands-free, using voice command. Built-in adaptive sensing ensures data stays private only to you.\n\n<a href="">More about protected adaptive sensing</a></string>
|
|
||||||
|
|
||||||
<!-- Manage full screen intent permission title [CHAR LIMIT=40] -->
|
<!-- Manage full screen intent permission title [CHAR LIMIT=40] -->
|
||||||
<string name="full_screen_intent_title">Full screen notifications</string>
|
<string name="full_screen_intent_title">Full screen notifications</string>
|
||||||
|
|
||||||
|
|||||||
@@ -116,11 +116,6 @@
|
|||||||
android:title="@string/full_screen_intent_title"
|
android:title="@string/full_screen_intent_title"
|
||||||
settings:controller="com.android.settings.spa.app.specialaccess.UseFullScreenIntentPreferenceController" />
|
settings:controller="com.android.settings.spa.app.specialaccess.UseFullScreenIntentPreferenceController" />
|
||||||
|
|
||||||
<Preference
|
|
||||||
android:key="voice_activation_apps"
|
|
||||||
android:title="@string/voice_activation_apps_title"
|
|
||||||
settings:controller="com.android.settings.spa.app.specialaccess.VoiceActivationAppsPreferenceController" />
|
|
||||||
|
|
||||||
<Preference
|
<Preference
|
||||||
android:key="picture_in_picture"
|
android:key="picture_in_picture"
|
||||||
android:title="@string/picture_in_picture_title"
|
android:title="@string/picture_in_picture_title"
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ import com.android.settings.spa.app.specialaccess.MediaManagementAppsAppListProv
|
|||||||
import com.android.settings.spa.app.specialaccess.ModifySystemSettingsAppListProvider
|
import com.android.settings.spa.app.specialaccess.ModifySystemSettingsAppListProvider
|
||||||
import com.android.settings.spa.app.specialaccess.NfcTagAppsSettingsProvider
|
import com.android.settings.spa.app.specialaccess.NfcTagAppsSettingsProvider
|
||||||
import com.android.settings.spa.app.specialaccess.PictureInPictureListProvider
|
import com.android.settings.spa.app.specialaccess.PictureInPictureListProvider
|
||||||
import com.android.settings.spa.app.specialaccess.VoiceActivationAppsListProvider
|
|
||||||
import com.android.settings.spa.app.specialaccess.WifiControlAppListProvider
|
import com.android.settings.spa.app.specialaccess.WifiControlAppListProvider
|
||||||
import com.android.settings.wifi.ChangeWifiStateDetails
|
import com.android.settings.wifi.ChangeWifiStateDetails
|
||||||
|
|
||||||
@@ -67,8 +66,6 @@ object SettingsActivityUtil {
|
|||||||
WifiControlAppListProvider.getAppInfoRoutePrefix(),
|
WifiControlAppListProvider.getAppInfoRoutePrefix(),
|
||||||
NfcTagAppsSettingsProvider::class.qualifiedName to
|
NfcTagAppsSettingsProvider::class.qualifiedName to
|
||||||
NfcTagAppsSettingsProvider.getAppInfoRoutePrefix(),
|
NfcTagAppsSettingsProvider.getAppInfoRoutePrefix(),
|
||||||
VoiceActivationAppsListProvider::class.qualifiedName to
|
|
||||||
VoiceActivationAppsListProvider.getAppInfoRoutePrefix(),
|
|
||||||
BackupTasksAppsListProvider::class.qualifiedName to
|
BackupTasksAppsListProvider::class.qualifiedName to
|
||||||
BackupTasksAppsListProvider.getAppInfoRoutePrefix(),
|
BackupTasksAppsListProvider.getAppInfoRoutePrefix(),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -229,13 +229,15 @@ public abstract class BiometricEnrollIntroduction extends BiometricEnrollBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show secondary button once scroll is completed.
|
// Show secondary button once scroll is completed.
|
||||||
if (!scrollNeeded) {
|
getSecondaryFooterButton().setVisibility(
|
||||||
if (!enrollmentCompleted) {
|
!scrollNeeded && !enrollmentCompleted ? View.VISIBLE : View.INVISIBLE);
|
||||||
getSecondaryFooterButton().setVisibility(View.VISIBLE);
|
mHasScrolledToBottom = !scrollNeeded;
|
||||||
}
|
|
||||||
mHasScrolledToBottom = true;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
final boolean isScrollNeeded = requireScrollMixin.isScrollingRequired();
|
||||||
|
final boolean enrollmentCompleted = checkMaxEnrolled() != 0;
|
||||||
|
getSecondaryFooterButton().setVisibility(
|
||||||
|
!isScrollNeeded && !enrollmentCompleted ? View.VISIBLE : View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.settings.network.telephony;
|
package com.android.settings.network.telephony;
|
||||||
|
|
||||||
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -28,20 +29,21 @@ import androidx.fragment.app.FragmentActivity;
|
|||||||
|
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.SubSettingLauncher;
|
import com.android.settings.core.SubSettingLauncher;
|
||||||
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
|
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||||
|
|
||||||
/** This dialog activity advise the user to have connectivity if the eSIM uses a RAC. */
|
/** This dialog activity advise the user to have connectivity if the eSIM uses a RAC. */
|
||||||
public class EuiccRacConnectivityDialogActivity extends FragmentActivity
|
public class EuiccRacConnectivityDialogActivity extends FragmentActivity
|
||||||
implements WarningDialogFragment.OnConfirmListener {
|
implements WarningDialogFragment.OnConfirmListener {
|
||||||
|
|
||||||
private static final String TAG = "EuiccRacConnectivityDialogActivity";
|
private static final String TAG = "EuiccRacConnectivityDialogActivity";
|
||||||
// Dialog tags
|
|
||||||
private static final int DIALOG_TAG_ERASE_ANYWAY_CONFIRMATION = 1;
|
|
||||||
private static final String ARG_SUB_ID = "sub_id";
|
private static final String ARG_SUB_ID = "sub_id";
|
||||||
private static final String ARG_RESET_MOBILE_NETWORK_ID = "reset_mobile_netword_id";
|
private static final String ARG_RESET_MOBILE_NETWORK_ID = "reset_mobile_netword_id";
|
||||||
|
|
||||||
private int mSubId;
|
private int mSubId;
|
||||||
@Nullable
|
@Nullable
|
||||||
private Intent mResetMobileNetworkIntent;
|
private Intent mResetMobileNetworkIntent;
|
||||||
|
private MetricsFeatureProvider mMetricsFeatureProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an intent of EuiccRacConnectivityDialogActivity for Settings: erase eSIM.
|
* Returns an intent of EuiccRacConnectivityDialogActivity for Settings: erase eSIM.
|
||||||
@@ -80,6 +82,7 @@ public class EuiccRacConnectivityDialogActivity extends FragmentActivity
|
|||||||
mSubId = intent.getIntExtra(ARG_SUB_ID, SubscriptionManager.INVALID_SUBSCRIPTION_ID);
|
mSubId = intent.getIntExtra(ARG_SUB_ID, SubscriptionManager.INVALID_SUBSCRIPTION_ID);
|
||||||
mResetMobileNetworkIntent =
|
mResetMobileNetworkIntent =
|
||||||
intent.getParcelableExtra(ARG_RESET_MOBILE_NETWORK_ID, Intent.class);
|
intent.getParcelableExtra(ARG_RESET_MOBILE_NETWORK_ID, Intent.class);
|
||||||
|
mMetricsFeatureProvider = FeatureFactory.getFeatureFactory().getMetricsFeatureProvider();
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
showConnectivityWarningDialog();
|
showConnectivityWarningDialog();
|
||||||
@@ -88,20 +91,26 @@ public class EuiccRacConnectivityDialogActivity extends FragmentActivity
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConfirm(int tag, boolean confirmed) {
|
public void onConfirm(int tag, boolean confirmed) {
|
||||||
|
if (tag == SettingsEnums.ACTION_SETTINGS_ESIM_RAC_CONNECTIVITY_WARNING
|
||||||
|
|| tag == SettingsEnums.ACTION_RESET_MOBILE_NETWORK_RAC_CONNECTIVITY_WARNING) {
|
||||||
|
mMetricsFeatureProvider.action(this, tag, confirmed ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (!confirmed) {
|
if (!confirmed) {
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
finish();
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case DIALOG_TAG_ERASE_ANYWAY_CONFIRMATION:
|
case SettingsEnums.ACTION_SETTINGS_ESIM_RAC_CONNECTIVITY_WARNING:
|
||||||
finish();
|
Log.i(TAG, "Show dialogue activity that handles deleting eSIM profile");
|
||||||
|
startActivity(DeleteEuiccSubscriptionDialogActivity.getIntent(this, mSubId));
|
||||||
|
break;
|
||||||
|
case SettingsEnums.ACTION_RESET_MOBILE_NETWORK_RAC_CONNECTIVITY_WARNING:
|
||||||
if (mResetMobileNetworkIntent != null) {
|
if (mResetMobileNetworkIntent != null) {
|
||||||
Log.i(TAG, "Show fragment activity that handles mobile network settings reset");
|
Log.i(TAG, "Show fragment activity that handles mobile network settings reset");
|
||||||
new SubSettingLauncher(this).launchWithIntent(mResetMobileNetworkIntent);
|
new SubSettingLauncher(this).launchWithIntent(mResetMobileNetworkIntent);
|
||||||
} else {
|
|
||||||
Log.i(TAG, "Show dialogue activity that handles deleting eSIM profiles");
|
|
||||||
startActivity(DeleteEuiccSubscriptionDialogActivity.getIntent(this, mSubId));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -115,10 +124,19 @@ public class EuiccRacConnectivityDialogActivity extends FragmentActivity
|
|||||||
WarningDialogFragment.show(
|
WarningDialogFragment.show(
|
||||||
this,
|
this,
|
||||||
WarningDialogFragment.OnConfirmListener.class,
|
WarningDialogFragment.OnConfirmListener.class,
|
||||||
DIALOG_TAG_ERASE_ANYWAY_CONFIRMATION,
|
getMetricsTag(),
|
||||||
getString(R.string.wifi_warning_dialog_title),
|
getString(R.string.wifi_warning_dialog_title),
|
||||||
getString(R.string.wifi_warning_dialog_text),
|
getString(R.string.wifi_warning_dialog_text),
|
||||||
getString(R.string.wifi_warning_continue_button),
|
getString(R.string.wifi_warning_continue_button),
|
||||||
getString(R.string.wifi_warning_return_button));
|
getString(R.string.wifi_warning_return_button));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Get the metrics tag depending on the intent. */
|
||||||
|
private int getMetricsTag() {
|
||||||
|
if (mResetMobileNetworkIntent != null) {
|
||||||
|
return SettingsEnums.ACTION_RESET_MOBILE_NETWORK_RAC_CONNECTIVITY_WARNING;
|
||||||
|
} else {
|
||||||
|
return SettingsEnums.ACTION_SETTINGS_ESIM_RAC_CONNECTIVITY_WARNING;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,20 +23,21 @@ import static android.provider.Settings.Secure.PRIVATE_SPACE_AUTO_LOCK_AFTER_DEV
|
|||||||
import static android.provider.Settings.Secure.USER_SETUP_COMPLETE;
|
import static android.provider.Settings.Secure.USER_SETUP_COMPLETE;
|
||||||
|
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.app.IActivityManager;
|
|
||||||
import android.app.KeyguardManager;
|
import android.app.KeyguardManager;
|
||||||
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.IntentFilter;
|
||||||
import android.content.IntentSender;
|
import android.content.IntentSender;
|
||||||
import android.content.pm.UserInfo;
|
import android.content.pm.UserInfo;
|
||||||
import android.os.Flags;
|
import android.os.Flags;
|
||||||
import android.os.RemoteException;
|
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.util.ArraySet;
|
import android.util.ArraySet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.VisibleForTesting;
|
import androidx.annotation.VisibleForTesting;
|
||||||
|
|
||||||
@@ -54,9 +55,12 @@ public class PrivateSpaceMaintainer {
|
|||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final UserManager mUserManager;
|
private final UserManager mUserManager;
|
||||||
|
private final ActivityManager mActivityManager;
|
||||||
@GuardedBy("this")
|
@GuardedBy("this")
|
||||||
private UserHandle mUserHandle;
|
private UserHandle mUserHandle;
|
||||||
private final KeyguardManager mKeyguardManager;
|
private final KeyguardManager mKeyguardManager;
|
||||||
|
/** This variable should be accessed via {@link #getBroadcastReceiver()} only. */
|
||||||
|
@Nullable private ProfileAvailabilityBroadcastReceiver mProfileAvailabilityBroadcastReceiver;
|
||||||
|
|
||||||
/** This is the default value for the hide private space entry point settings. */
|
/** This is the default value for the hide private space entry point settings. */
|
||||||
public static final int HIDE_PRIVATE_SPACE_ENTRY_POINT_DISABLED_VAL = 0;
|
public static final int HIDE_PRIVATE_SPACE_ENTRY_POINT_DISABLED_VAL = 0;
|
||||||
@@ -106,12 +110,13 @@ public class PrivateSpaceMaintainer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
IActivityManager am = ActivityManager.getService();
|
registerBroadcastReceiver();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//TODO(b/313926659): To check and handle failure of startProfile
|
//TODO(b/313926659): To check and handle failure of startProfile
|
||||||
am.startProfile(mUserHandle.getIdentifier());
|
mActivityManager.startProfile(mUserHandle);
|
||||||
} catch (RemoteException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
Log.e(TAG, "Failed to start private profile");
|
Log.e(TAG, "Unexpected that " + mUserHandle.getIdentifier() + " is not a profile");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,6 +141,7 @@ public class PrivateSpaceMaintainer {
|
|||||||
Log.i(TAG, "Deleting Private space with id: " + mUserHandle.getIdentifier());
|
Log.i(TAG, "Deleting Private space with id: " + mUserHandle.getIdentifier());
|
||||||
if (mUserManager.removeUser(mUserHandle)) {
|
if (mUserManager.removeUser(mUserHandle)) {
|
||||||
Log.i(TAG, "Private space deleted");
|
Log.i(TAG, "Private space deleted");
|
||||||
|
unregisterBroadcastReceiver();
|
||||||
mUserHandle = null;
|
mUserHandle = null;
|
||||||
|
|
||||||
return ErrorDeletingPrivateSpace.DELETE_PS_ERROR_NONE;
|
return ErrorDeletingPrivateSpace.DELETE_PS_ERROR_NONE;
|
||||||
@@ -162,6 +168,7 @@ public class PrivateSpaceMaintainer {
|
|||||||
for (UserInfo user : users) {
|
for (UserInfo user : users) {
|
||||||
if (user.isPrivateProfile()) {
|
if (user.isPrivateProfile()) {
|
||||||
mUserHandle = user.getUserHandle();
|
mUserHandle = user.getUserHandle();
|
||||||
|
registerBroadcastReceiver();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -215,6 +222,7 @@ public class PrivateSpaceMaintainer {
|
|||||||
mContext = context.getApplicationContext();
|
mContext = context.getApplicationContext();
|
||||||
mUserManager = mContext.getSystemService(UserManager.class);
|
mUserManager = mContext.getSystemService(UserManager.class);
|
||||||
mKeyguardManager = mContext.getSystemService(KeyguardManager.class);
|
mKeyguardManager = mContext.getSystemService(KeyguardManager.class);
|
||||||
|
mActivityManager = mContext.getSystemService(ActivityManager.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -338,4 +346,91 @@ public class PrivateSpaceMaintainer {
|
|||||||
&& android.multiuser.Flags.supportAutolockForPrivateSpace()
|
&& android.multiuser.Flags.supportAutolockForPrivateSpace()
|
||||||
&& android.multiuser.Flags.enablePrivateSpaceFeatures();
|
&& android.multiuser.Flags.enablePrivateSpaceFeatures();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@link BroadcastReceiver} which handles the private profile's availability related
|
||||||
|
* broadcasts.
|
||||||
|
*/
|
||||||
|
private final class ProfileAvailabilityBroadcastReceiver extends BroadcastReceiver {
|
||||||
|
void register() {
|
||||||
|
Log.d(TAG, "Registering the receiver");
|
||||||
|
IntentFilter filter = new IntentFilter();
|
||||||
|
filter.addAction(Intent.ACTION_PROFILE_UNAVAILABLE);
|
||||||
|
mContext.registerReceiver(/* receiver= */ this, filter, Context.RECEIVER_NOT_EXPORTED);
|
||||||
|
}
|
||||||
|
|
||||||
|
void unregister() {
|
||||||
|
Log.d(TAG, "Unregistering the receiver");
|
||||||
|
mContext.unregisterReceiver(/* receiver= */ this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReceive(@NonNull Context context, @NonNull Intent intent) {
|
||||||
|
UserHandle userHandle = intent.getParcelableExtra(Intent.EXTRA_USER, UserHandle.class);
|
||||||
|
if (!userHandle.equals(getPrivateProfileHandle())) {
|
||||||
|
Log.d(TAG, "Ignoring intent for non-private profile with user id "
|
||||||
|
+ userHandle.getIdentifier());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.i(TAG, "Removing all Settings tasks.");
|
||||||
|
removeSettingsAllTasks();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private synchronized void registerBroadcastReceiver() {
|
||||||
|
if (!android.os.Flags.allowPrivateProfile()
|
||||||
|
|| !android.multiuser.Flags.enablePrivateSpaceFeatures()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var broadcastReceiver = getBroadcastReceiver();
|
||||||
|
if (broadcastReceiver == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
broadcastReceiver.register();
|
||||||
|
}
|
||||||
|
|
||||||
|
private synchronized void unregisterBroadcastReceiver() {
|
||||||
|
if (!android.os.Flags.allowPrivateProfile()
|
||||||
|
|| !android.multiuser.Flags.enablePrivateSpaceFeatures()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (mProfileAvailabilityBroadcastReceiver == null) {
|
||||||
|
Log.w(TAG, "Requested to unregister when there is no receiver.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mProfileAvailabilityBroadcastReceiver.unregister();
|
||||||
|
mProfileAvailabilityBroadcastReceiver = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Always use this getter to access {@link #mProfileAvailabilityBroadcastReceiver}. */
|
||||||
|
@VisibleForTesting
|
||||||
|
@Nullable synchronized ProfileAvailabilityBroadcastReceiver getBroadcastReceiver() {
|
||||||
|
if (!android.os.Flags.allowPrivateProfile()
|
||||||
|
|| !android.multiuser.Flags.enablePrivateSpaceFeatures()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (!doesPrivateSpaceExist()) {
|
||||||
|
Log.e(TAG, "Cannot return a broadcast receiver when private space doesn't exist");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (mProfileAvailabilityBroadcastReceiver == null) {
|
||||||
|
mProfileAvailabilityBroadcastReceiver = new ProfileAvailabilityBroadcastReceiver();
|
||||||
|
}
|
||||||
|
return mProfileAvailabilityBroadcastReceiver;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** This is purely for testing purpose only, and should not be used elsewhere. */
|
||||||
|
@VisibleForTesting
|
||||||
|
synchronized void resetBroadcastReceiver() {
|
||||||
|
mProfileAvailabilityBroadcastReceiver = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeSettingsAllTasks() {
|
||||||
|
List<ActivityManager.AppTask> appTasks = mActivityManager.getAppTasks();
|
||||||
|
for (var appTask : appTasks) {
|
||||||
|
if (!appTask.getTaskInfo().isVisible()) {
|
||||||
|
appTask.finishAndRemoveTask();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ import com.android.settings.spa.app.specialaccess.PictureInPictureListProvider
|
|||||||
import com.android.settings.spa.app.specialaccess.SpecialAppAccessPageProvider
|
import com.android.settings.spa.app.specialaccess.SpecialAppAccessPageProvider
|
||||||
import com.android.settings.spa.app.specialaccess.TurnScreenOnAppsAppListProvider
|
import com.android.settings.spa.app.specialaccess.TurnScreenOnAppsAppListProvider
|
||||||
import com.android.settings.spa.app.specialaccess.UseFullScreenIntentAppListProvider
|
import com.android.settings.spa.app.specialaccess.UseFullScreenIntentAppListProvider
|
||||||
import com.android.settings.spa.app.specialaccess.VoiceActivationAppsListProvider
|
|
||||||
import com.android.settings.spa.app.specialaccess.WifiControlAppListProvider
|
import com.android.settings.spa.app.specialaccess.WifiControlAppListProvider
|
||||||
import com.android.settings.spa.app.storage.StorageAppListPageProvider
|
import com.android.settings.spa.app.storage.StorageAppListPageProvider
|
||||||
import com.android.settings.spa.core.instrumentation.SpaLogProvider
|
import com.android.settings.spa.core.instrumentation.SpaLogProvider
|
||||||
@@ -76,7 +75,6 @@ open class SettingsSpaEnvironment(context: Context) : SpaEnvironment(context) {
|
|||||||
PictureInPictureListProvider,
|
PictureInPictureListProvider,
|
||||||
InstallUnknownAppsListProvider,
|
InstallUnknownAppsListProvider,
|
||||||
AlarmsAndRemindersAppListProvider,
|
AlarmsAndRemindersAppListProvider,
|
||||||
VoiceActivationAppsListProvider,
|
|
||||||
WifiControlAppListProvider,
|
WifiControlAppListProvider,
|
||||||
NfcTagAppsSettingsProvider,
|
NfcTagAppsSettingsProvider,
|
||||||
LongBackgroundTasksAppListProvider,
|
LongBackgroundTasksAppListProvider,
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ import com.android.settings.spa.app.specialaccess.DisplayOverOtherAppsAppListPro
|
|||||||
import com.android.settings.spa.app.specialaccess.InstallUnknownAppsListProvider
|
import com.android.settings.spa.app.specialaccess.InstallUnknownAppsListProvider
|
||||||
import com.android.settings.spa.app.specialaccess.ModifySystemSettingsAppListProvider
|
import com.android.settings.spa.app.specialaccess.ModifySystemSettingsAppListProvider
|
||||||
import com.android.settings.spa.app.specialaccess.PictureInPictureListProvider
|
import com.android.settings.spa.app.specialaccess.PictureInPictureListProvider
|
||||||
import com.android.settings.spa.app.specialaccess.VoiceActivationAppsListProvider
|
|
||||||
import com.android.settingslib.spa.framework.common.SettingsPageProvider
|
import com.android.settingslib.spa.framework.common.SettingsPageProvider
|
||||||
import com.android.settingslib.spa.framework.compose.navigator
|
import com.android.settingslib.spa.framework.compose.navigator
|
||||||
import com.android.settingslib.spa.widget.scaffold.RegularScaffold
|
import com.android.settingslib.spa.widget.scaffold.RegularScaffold
|
||||||
@@ -167,9 +166,6 @@ private fun AppInfoSettings(packageInfoPresenter: PackageInfoPresenter) {
|
|||||||
InstallUnknownAppsListProvider.InfoPageEntryItem(app)
|
InstallUnknownAppsListProvider.InfoPageEntryItem(app)
|
||||||
InteractAcrossProfilesDetailsPreference(app)
|
InteractAcrossProfilesDetailsPreference(app)
|
||||||
AlarmsAndRemindersAppListProvider.InfoPageEntryItem(app)
|
AlarmsAndRemindersAppListProvider.InfoPageEntryItem(app)
|
||||||
if (Flags.enableVoiceActivationAppsInSettings()) {
|
|
||||||
VoiceActivationAppsListProvider.InfoPageEntryItem(app)
|
|
||||||
}
|
|
||||||
if (Flags.enablePerformBackupTasksInSettings()) {
|
if (Flags.enablePerformBackupTasksInSettings()) {
|
||||||
BackupTasksAppsListProvider.InfoPageEntryItem(app)
|
BackupTasksAppsListProvider.InfoPageEntryItem(app)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ object SpecialAppAccessPageProvider : SettingsPageProvider {
|
|||||||
PictureInPictureListProvider,
|
PictureInPictureListProvider,
|
||||||
InstallUnknownAppsListProvider,
|
InstallUnknownAppsListProvider,
|
||||||
AlarmsAndRemindersAppListProvider,
|
AlarmsAndRemindersAppListProvider,
|
||||||
VoiceActivationAppsListProvider,
|
|
||||||
WifiControlAppListProvider,
|
WifiControlAppListProvider,
|
||||||
LongBackgroundTasksAppListProvider,
|
LongBackgroundTasksAppListProvider,
|
||||||
TurnScreenOnAppsAppListProvider,
|
TurnScreenOnAppsAppListProvider,
|
||||||
|
|||||||
@@ -1,67 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2023 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 com.android.settings.spa.app.specialaccess
|
|
||||||
|
|
||||||
import android.Manifest
|
|
||||||
import android.app.AppOpsManager
|
|
||||||
import android.app.settings.SettingsEnums
|
|
||||||
import android.content.Context
|
|
||||||
import com.android.settings.R
|
|
||||||
import com.android.settings.overlay.FeatureFactory
|
|
||||||
import com.android.settingslib.spaprivileged.model.app.PackageManagers.hasGrantPermission
|
|
||||||
import com.android.settingslib.spaprivileged.template.app.AppOpPermissionListModel
|
|
||||||
import com.android.settingslib.spaprivileged.template.app.AppOpPermissionRecord
|
|
||||||
import com.android.settingslib.spaprivileged.template.app.TogglePermissionAppListProvider
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class builds an App List under voice activation apps and the individual page which
|
|
||||||
* allows the user to toggle voice activation related permissions on / off for the apps displayed
|
|
||||||
* in the list.
|
|
||||||
*/
|
|
||||||
object VoiceActivationAppsListProvider : TogglePermissionAppListProvider {
|
|
||||||
override val permissionType = "VoiceActivationApps"
|
|
||||||
override fun createModel(context: Context) = VoiceActivationAppsListModel(context)
|
|
||||||
}
|
|
||||||
|
|
||||||
class VoiceActivationAppsListModel(context: Context) : AppOpPermissionListModel(context) {
|
|
||||||
override val pageTitleResId = R.string.voice_activation_apps_title
|
|
||||||
override val switchTitleResId = R.string.permit_voice_activation_apps
|
|
||||||
override val footerResId = R.string.allow_voice_activation_apps_description
|
|
||||||
override val appOp = AppOpsManager.OP_RECEIVE_SANDBOX_TRIGGER_AUDIO
|
|
||||||
override val permission = Manifest.permission.RECEIVE_SANDBOX_TRIGGER_AUDIO
|
|
||||||
override val setModeByUid = true
|
|
||||||
|
|
||||||
override fun setAllowed(record: AppOpPermissionRecord, newAllowed: Boolean) {
|
|
||||||
super.setAllowed(record, newAllowed)
|
|
||||||
logPermissionChange(newAllowed)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun isChangeable(record: AppOpPermissionRecord): Boolean =
|
|
||||||
super.isChangeable(record) && record.app.hasGrantPermission(permission)
|
|
||||||
|
|
||||||
private fun logPermissionChange(newAllowed: Boolean) {
|
|
||||||
val category = when {
|
|
||||||
newAllowed -> SettingsEnums.APP_SPECIAL_PERMISSION_RECEIVE_SANDBOX_TRIGGER_AUDIO_ALLOW
|
|
||||||
else -> SettingsEnums.APP_SPECIAL_PERMISSION_RECEIVE_SANDBOX_TRIGGER_AUDIO_DENY
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Leave the package string empty as we should not log the package names for the collected
|
|
||||||
* metrics.
|
|
||||||
*/
|
|
||||||
FeatureFactory.featureFactory.metricsFeatureProvider.action(context, category, "")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2023 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 com.android.settings.spa.app.specialaccess
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import androidx.preference.Preference
|
|
||||||
import com.android.settings.core.BasePreferenceController
|
|
||||||
import com.android.settings.flags.Flags
|
|
||||||
import com.android.settings.spa.SpaActivity.Companion.startSpaActivity
|
|
||||||
|
|
||||||
class VoiceActivationAppsPreferenceController(context: Context, preferenceKey: String) :
|
|
||||||
BasePreferenceController(context, preferenceKey) {
|
|
||||||
override fun getAvailabilityStatus() =
|
|
||||||
if (Flags.enableVoiceActivationAppsInSettings()) AVAILABLE
|
|
||||||
else CONDITIONALLY_UNAVAILABLE
|
|
||||||
|
|
||||||
override fun handlePreferenceTreeClick(preference: Preference): Boolean {
|
|
||||||
if (preference.key == mPreferenceKey) {
|
|
||||||
mContext.startSpaActivity(VoiceActivationAppsListProvider.getAppListRoute())
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -78,6 +78,7 @@ import com.google.android.setupcompat.template.FooterBarMixin;
|
|||||||
import com.google.android.setupcompat.template.FooterButton;
|
import com.google.android.setupcompat.template.FooterButton;
|
||||||
import com.google.android.setupcompat.util.WizardManagerHelper;
|
import com.google.android.setupcompat.util.WizardManagerHelper;
|
||||||
import com.google.android.setupdesign.GlifLayout;
|
import com.google.android.setupdesign.GlifLayout;
|
||||||
|
import com.google.android.setupdesign.template.RequireScrollMixin;
|
||||||
import com.google.android.setupdesign.view.BottomScrollView;
|
import com.google.android.setupdesign.view.BottomScrollView;
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
@@ -137,6 +138,11 @@ public class FaceEnrollIntroductionTest {
|
|||||||
return mRecreateCount;
|
return mRecreateCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recreate() {
|
public void recreate() {
|
||||||
mRecreateCount++;
|
mRecreateCount++;
|
||||||
@@ -424,11 +430,39 @@ public class FaceEnrollIntroductionTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFaceEnrollIntroduction_notShowFooterSecondaryButton() {
|
public void testFaceEnrollIntroduction_footerSecondaryButtonWhenCanEnroll() {
|
||||||
setupActivity();
|
setupActivity();
|
||||||
FooterBarMixin footer = getGlifLayout(mActivity).getMixin(FooterBarMixin.class);
|
FooterBarMixin footer = getGlifLayout(mActivity).getMixin(FooterBarMixin.class);
|
||||||
FooterButton footerButton = footer.getSecondaryButton();
|
FooterButton footerButton = footer.getSecondaryButton();
|
||||||
|
|
||||||
|
final RequireScrollMixin requireScrollMixin = getGlifLayout(mActivity).getMixin(
|
||||||
|
RequireScrollMixin.class);
|
||||||
|
assertThat(footerButton.getVisibility()).isEqualTo(
|
||||||
|
requireScrollMixin.isScrollingRequired() ? View.INVISIBLE : View.VISIBLE);
|
||||||
|
|
||||||
|
requireScrollMixin.getOnRequireScrollStateChangedListener().onRequireScrollStateChanged(
|
||||||
|
false);
|
||||||
|
assertThat(footerButton.getVisibility()).isEqualTo(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFaceEnrollIntroduction_footerSecondaryButtonWhenMaxEnroll() {
|
||||||
|
setFaceManagerToHave(1 /* numEnrollments */);
|
||||||
|
final Intent intent = new Intent();
|
||||||
|
intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, new byte[0]);
|
||||||
|
mController = Robolectric.buildActivity(TestFaceEnrollIntroduction.class, intent);
|
||||||
|
mActivity = (TestFaceEnrollIntroduction) mController.get();
|
||||||
|
|
||||||
|
mController.create();
|
||||||
|
|
||||||
|
FooterBarMixin footer = getGlifLayout(mActivity).getMixin(FooterBarMixin.class);
|
||||||
|
FooterButton footerButton = footer.getSecondaryButton();
|
||||||
|
final RequireScrollMixin requireScrollMixin = getGlifLayout(mActivity).getMixin(
|
||||||
|
RequireScrollMixin.class);
|
||||||
|
assertThat(footerButton.getVisibility()).isEqualTo(View.INVISIBLE);
|
||||||
|
|
||||||
|
requireScrollMixin.getOnRequireScrollStateChangedListener().onRequireScrollStateChanged(
|
||||||
|
false);
|
||||||
assertThat(footerButton.getVisibility()).isEqualTo(View.INVISIBLE);
|
assertThat(footerButton.getVisibility()).isEqualTo(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -183,14 +183,6 @@ public class FingerprintEnrollIntroductionTest {
|
|||||||
int result = mFingerprintEnrollIntroduction.checkMaxEnrolled();
|
int result = mFingerprintEnrollIntroduction.checkMaxEnrolled();
|
||||||
|
|
||||||
assertThat(result).isEqualTo(0);
|
assertThat(result).isEqualTo(0);
|
||||||
|
|
||||||
final RequireScrollMixin requireScrollMixin =
|
|
||||||
((GlifLayout) mFingerprintEnrollIntroduction.findViewById(
|
|
||||||
R.id.setup_wizard_layout)).getMixin(RequireScrollMixin.class);
|
|
||||||
requireScrollMixin.getOnRequireScrollStateChangedListener().onRequireScrollStateChanged(
|
|
||||||
false);
|
|
||||||
Assert.assertEquals(View.VISIBLE,
|
|
||||||
mFingerprintEnrollIntroduction.getSecondaryFooterButton().getVisibility());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -206,14 +198,6 @@ public class FingerprintEnrollIntroductionTest {
|
|||||||
int result = mFingerprintEnrollIntroduction.checkMaxEnrolled();
|
int result = mFingerprintEnrollIntroduction.checkMaxEnrolled();
|
||||||
|
|
||||||
assertThat(result).isEqualTo(R.string.fingerprint_intro_error_max);
|
assertThat(result).isEqualTo(R.string.fingerprint_intro_error_max);
|
||||||
|
|
||||||
final RequireScrollMixin requireScrollMixin =
|
|
||||||
((GlifLayout) mFingerprintEnrollIntroduction.findViewById(
|
|
||||||
R.id.setup_wizard_layout)).getMixin(RequireScrollMixin.class);
|
|
||||||
requireScrollMixin.getOnRequireScrollStateChangedListener().onRequireScrollStateChanged(
|
|
||||||
false);
|
|
||||||
Assert.assertEquals(View.INVISIBLE,
|
|
||||||
mFingerprintEnrollIntroduction.getSecondaryFooterButton().getVisibility());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -321,6 +305,57 @@ public class FingerprintEnrollIntroductionTest {
|
|||||||
.isEqualTo(FingerprintEnrollOptions.ENROLL_REASON_SETTINGS);
|
.isEqualTo(FingerprintEnrollOptions.ENROLL_REASON_SETTINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void intro_CheckNoThanksButtonWhenCanEnroll() {
|
||||||
|
// This code path should depend on suw_max_fingerprints_enrollable versus
|
||||||
|
// FingerprintManager.getSensorProperties...maxEnrollmentsPerUser()
|
||||||
|
Resources resources = mock(Resources.class);
|
||||||
|
when(resources.getInteger(anyInt())).thenReturn(5);
|
||||||
|
when(mContext.getResources()).thenReturn(resources);
|
||||||
|
|
||||||
|
setupFingerprintEnrollIntroWith(newFirstSuwIntent());
|
||||||
|
setFingerprintManagerToHave(0 /* numEnrollments */);
|
||||||
|
|
||||||
|
final RequireScrollMixin requireScrollMixin =
|
||||||
|
((GlifLayout) mFingerprintEnrollIntroduction.findViewById(
|
||||||
|
R.id.setup_wizard_layout)).getMixin(RequireScrollMixin.class);
|
||||||
|
|
||||||
|
Assert.assertEquals(
|
||||||
|
requireScrollMixin.isScrollingRequired() ? View.INVISIBLE : View.VISIBLE,
|
||||||
|
mFingerprintEnrollIntroduction.getSecondaryFooterButton().getVisibility());
|
||||||
|
|
||||||
|
requireScrollMixin.getOnRequireScrollStateChangedListener().onRequireScrollStateChanged(
|
||||||
|
false);
|
||||||
|
Assert.assertEquals(View.VISIBLE,
|
||||||
|
mFingerprintEnrollIntroduction.getSecondaryFooterButton().getVisibility());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void intro_CheckNoThanksButtonWhenMaxEnroll() {
|
||||||
|
// This code path should depend on suw_max_fingerprints_enrollable versus
|
||||||
|
// FingerprintManager.getSensorProperties...maxEnrollmentsPerUser()
|
||||||
|
Resources resources = mock(Resources.class);
|
||||||
|
when(mContext.getResources()).thenReturn(resources);
|
||||||
|
when(resources.getInteger(anyInt())).thenReturn(1);
|
||||||
|
|
||||||
|
setupFingerprintEnrollIntroWith(newFirstSuwIntent());
|
||||||
|
setFingerprintManagerToHave(1 /* numEnrollments */);
|
||||||
|
|
||||||
|
final RequireScrollMixin requireScrollMixin =
|
||||||
|
((GlifLayout) mFingerprintEnrollIntroduction.findViewById(
|
||||||
|
R.id.setup_wizard_layout)).getMixin(RequireScrollMixin.class);
|
||||||
|
|
||||||
|
mFingerprintEnrollIntroduction.onResume();
|
||||||
|
Assert.assertEquals(View.INVISIBLE,
|
||||||
|
mFingerprintEnrollIntroduction.getSecondaryFooterButton().getVisibility());
|
||||||
|
|
||||||
|
requireScrollMixin.getOnRequireScrollStateChangedListener().onRequireScrollStateChanged(
|
||||||
|
false);
|
||||||
|
Assert.assertEquals(View.INVISIBLE,
|
||||||
|
mFingerprintEnrollIntroduction.getSecondaryFooterButton().getVisibility());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private Intent newTokenOnlyIntent() {
|
private Intent newTokenOnlyIntent() {
|
||||||
return new Intent()
|
return new Intent()
|
||||||
.putExtra(EXTRA_KEY_CHALLENGE_TOKEN, new byte[] { 1 });
|
.putExtra(EXTRA_KEY_CHALLENGE_TOKEN, new byte[] { 1 });
|
||||||
@@ -365,6 +400,11 @@ public class FingerprintEnrollIntroductionTest {
|
|||||||
public int mNewSensorId;
|
public int mNewSensorId;
|
||||||
public long mNewChallenge;
|
public long mNewChallenge;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public byte[] getTokenField() {
|
public byte[] getTokenField() {
|
||||||
return mToken;
|
return mToken;
|
||||||
|
|||||||
@@ -0,0 +1,96 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2024 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 com.android.settings.network.telephony;
|
||||||
|
|
||||||
|
import static org.mockito.Mockito.spy;
|
||||||
|
import static org.mockito.Mockito.verify;
|
||||||
|
|
||||||
|
import android.app.settings.SettingsEnums;
|
||||||
|
|
||||||
|
import com.android.settings.testutils.FakeFeatureFactory;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.robolectric.Robolectric;
|
||||||
|
import org.robolectric.RobolectricTestRunner;
|
||||||
|
|
||||||
|
@RunWith(RobolectricTestRunner.class)
|
||||||
|
public class EuiccRacConnectivityDialogActivityTest {
|
||||||
|
private static final boolean CONFIRMED = true;
|
||||||
|
|
||||||
|
private FakeFeatureFactory mFeatureFactory;
|
||||||
|
private EuiccRacConnectivityDialogActivity mActivity;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
mFeatureFactory = FakeFeatureFactory.setupForTest();
|
||||||
|
mActivity = spy(Robolectric.buildActivity(EuiccRacConnectivityDialogActivity.class).get());
|
||||||
|
mActivity.onCreate(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void dialogAction_continue_intentResetMobileNetwork_metricsLogged() {
|
||||||
|
mActivity.onConfirm(
|
||||||
|
SettingsEnums.ACTION_RESET_MOBILE_NETWORK_RAC_CONNECTIVITY_WARNING, CONFIRMED);
|
||||||
|
|
||||||
|
verify(mFeatureFactory.metricsFeatureProvider)
|
||||||
|
.action(
|
||||||
|
mActivity,
|
||||||
|
SettingsEnums.ACTION_RESET_MOBILE_NETWORK_RAC_CONNECTIVITY_WARNING,
|
||||||
|
getMetricsValue(CONFIRMED));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void dialogAction_back_intentResetMobileNetwork_metricsLogged() {
|
||||||
|
mActivity.onConfirm(
|
||||||
|
SettingsEnums.ACTION_RESET_MOBILE_NETWORK_RAC_CONNECTIVITY_WARNING, !CONFIRMED);
|
||||||
|
|
||||||
|
verify(mFeatureFactory.metricsFeatureProvider)
|
||||||
|
.action(
|
||||||
|
mActivity,
|
||||||
|
SettingsEnums.ACTION_RESET_MOBILE_NETWORK_RAC_CONNECTIVITY_WARNING,
|
||||||
|
getMetricsValue(!CONFIRMED));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void dialogAction_continue_intentSettingsEsimDelete_metricsLogged() {
|
||||||
|
mActivity.onConfirm(SettingsEnums.ACTION_SETTINGS_ESIM_RAC_CONNECTIVITY_WARNING, CONFIRMED);
|
||||||
|
|
||||||
|
verify(mFeatureFactory.metricsFeatureProvider)
|
||||||
|
.action(
|
||||||
|
mActivity,
|
||||||
|
SettingsEnums.ACTION_SETTINGS_ESIM_RAC_CONNECTIVITY_WARNING,
|
||||||
|
getMetricsValue(CONFIRMED));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void dialogAction_back_intentSettingsEsimDelete_metricsLogged() {
|
||||||
|
mActivity.onConfirm(
|
||||||
|
SettingsEnums.ACTION_SETTINGS_ESIM_RAC_CONNECTIVITY_WARNING, !CONFIRMED);
|
||||||
|
|
||||||
|
verify(mFeatureFactory.metricsFeatureProvider)
|
||||||
|
.action(
|
||||||
|
mActivity,
|
||||||
|
SettingsEnums.ACTION_SETTINGS_ESIM_RAC_CONNECTIVITY_WARNING,
|
||||||
|
getMetricsValue(!CONFIRMED));
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getMetricsValue(boolean confirmed) {
|
||||||
|
return confirmed ? 1 : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
package com.android.settings.spa.app.specialaccess
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.platform.test.annotations.RequiresFlagsDisabled
|
|
||||||
import android.platform.test.annotations.RequiresFlagsEnabled
|
|
||||||
import android.platform.test.flag.junit.CheckFlagsRule
|
|
||||||
import android.platform.test.flag.junit.DeviceFlagsValueProvider
|
|
||||||
import androidx.preference.Preference
|
|
||||||
import androidx.test.core.app.ApplicationProvider
|
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
|
||||||
|
|
||||||
import com.android.settings.flags.Flags
|
|
||||||
import com.google.common.truth.Truth.assertThat
|
|
||||||
|
|
||||||
import org.junit.Rule
|
|
||||||
import org.junit.Test
|
|
||||||
import org.junit.runner.RunWith
|
|
||||||
import org.mockito.kotlin.any
|
|
||||||
import org.mockito.kotlin.doNothing
|
|
||||||
import org.mockito.kotlin.spy
|
|
||||||
import org.mockito.kotlin.whenever
|
|
||||||
|
|
||||||
@RunWith(AndroidJUnit4::class)
|
|
||||||
class VoiceActivationAppsPreferenceControllerTest {
|
|
||||||
|
|
||||||
@get:Rule
|
|
||||||
val checkFlagsRule: CheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule()
|
|
||||||
|
|
||||||
private val context: Context = spy(ApplicationProvider.getApplicationContext()) {
|
|
||||||
doNothing().whenever(mock).startActivity(any())
|
|
||||||
}
|
|
||||||
|
|
||||||
private val matchedPreference = Preference(context).apply { key = preferenceKey }
|
|
||||||
|
|
||||||
private val misMatchedPreference = Preference(context).apply { key = testPreferenceKey }
|
|
||||||
|
|
||||||
private val controller = VoiceActivationAppsPreferenceController(context, preferenceKey)
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@RequiresFlagsEnabled(Flags.FLAG_ENABLE_VOICE_ACTIVATION_APPS_IN_SETTINGS)
|
|
||||||
fun getAvailabilityStatus_enableVoiceActivationApps_returnAvailable() {
|
|
||||||
assertThat(controller.isAvailable).isTrue()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@RequiresFlagsDisabled(Flags.FLAG_ENABLE_VOICE_ACTIVATION_APPS_IN_SETTINGS)
|
|
||||||
fun getAvailableStatus_disableVoiceActivationApps_returnConditionallyUnavailable() {
|
|
||||||
assertThat(controller.isAvailable).isFalse()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun handlePreferenceTreeClick_keyMatched_returnTrue() {
|
|
||||||
assertThat(controller.handlePreferenceTreeClick(matchedPreference)).isTrue()
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun handlePreferenceTreeClick_keyMisMatched_returnFalse() {
|
|
||||||
assertThat(controller.handlePreferenceTreeClick(misMatchedPreference)).isFalse()
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
private const val preferenceKey: String = "voice_activation_apps"
|
|
||||||
private const val testPreferenceKey: String = "test_key"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
package com.android.settings.spa.app.specialaccess
|
|
||||||
|
|
||||||
import android.Manifest
|
|
||||||
import android.app.AppOpsManager
|
|
||||||
import android.content.Context
|
|
||||||
import androidx.test.core.app.ApplicationProvider
|
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
|
||||||
import com.android.settings.R
|
|
||||||
import com.google.common.truth.Truth.assertThat
|
|
||||||
import org.junit.Test
|
|
||||||
import org.junit.runner.RunWith
|
|
||||||
|
|
||||||
@RunWith(AndroidJUnit4::class)
|
|
||||||
class VoiceActivationAppsTest {
|
|
||||||
private val context: Context = ApplicationProvider.getApplicationContext()
|
|
||||||
|
|
||||||
private val listModel = VoiceActivationAppsListModel(context)
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun modelResourceIdAndProperties() {
|
|
||||||
assertThat(listModel.pageTitleResId).isEqualTo(R.string.voice_activation_apps_title)
|
|
||||||
assertThat(listModel.switchTitleResId).isEqualTo(R.string.permit_voice_activation_apps)
|
|
||||||
assertThat(listModel.footerResId).isEqualTo(R.string.allow_voice_activation_apps_description)
|
|
||||||
assertThat(listModel.appOp).isEqualTo(AppOpsManager.OP_RECEIVE_SANDBOX_TRIGGER_AUDIO)
|
|
||||||
assertThat(listModel.permission).isEqualTo(
|
|
||||||
Manifest.permission.RECEIVE_SANDBOX_TRIGGER_AUDIO
|
|
||||||
)
|
|
||||||
assertThat(listModel.setModeByUid).isTrue()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -101,6 +101,7 @@ public class PrivateSpaceMaintainerTest {
|
|||||||
android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
|
android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
|
||||||
PrivateSpaceMaintainer privateSpaceMaintainer =
|
PrivateSpaceMaintainer privateSpaceMaintainer =
|
||||||
PrivateSpaceMaintainer.getInstance(mContext);
|
PrivateSpaceMaintainer.getInstance(mContext);
|
||||||
|
privateSpaceMaintainer.deletePrivateSpace();
|
||||||
ErrorDeletingPrivateSpace errorDeletingPrivateSpace =
|
ErrorDeletingPrivateSpace errorDeletingPrivateSpace =
|
||||||
privateSpaceMaintainer.deletePrivateSpace();
|
privateSpaceMaintainer.deletePrivateSpace();
|
||||||
assertThat(errorDeletingPrivateSpace)
|
assertThat(errorDeletingPrivateSpace)
|
||||||
@@ -197,6 +198,30 @@ public class PrivateSpaceMaintainerTest {
|
|||||||
.isEqualTo(HIDE_PRIVATE_SPACE_ENTRY_POINT_ENABLED_VAL);
|
.isEqualTo(HIDE_PRIVATE_SPACE_ENTRY_POINT_ENABLED_VAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void createPrivateSpace_psDoesNotExist_registersTheBroadcastReceiver() {
|
||||||
|
mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
|
||||||
|
android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
|
||||||
|
PrivateSpaceMaintainer privateSpaceMaintainer =
|
||||||
|
PrivateSpaceMaintainer.getInstance(mContext);
|
||||||
|
privateSpaceMaintainer.deletePrivateSpace();
|
||||||
|
privateSpaceMaintainer.createPrivateSpace();
|
||||||
|
// test that no exception is thrown, which would indicate that the receiver was registered.
|
||||||
|
mContext.unregisterReceiver(privateSpaceMaintainer.getBroadcastReceiver());
|
||||||
|
privateSpaceMaintainer.resetBroadcastReceiver();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void deletePrivateSpace_psExists_unregistersTheBroadcastReceiver() {
|
||||||
|
mSetFlagsRule.enableFlags(Flags.FLAG_ALLOW_PRIVATE_PROFILE,
|
||||||
|
android.multiuser.Flags.FLAG_ENABLE_PRIVATE_SPACE_FEATURES);
|
||||||
|
PrivateSpaceMaintainer privateSpaceMaintainer =
|
||||||
|
PrivateSpaceMaintainer.getInstance(mContext);
|
||||||
|
privateSpaceMaintainer.createPrivateSpace();
|
||||||
|
privateSpaceMaintainer.deletePrivateSpace();
|
||||||
|
assertThat(privateSpaceMaintainer.getBroadcastReceiver()).isNull();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests that {@link PrivateSpaceMaintainer#lockPrivateSpace()} when PS exists and is running
|
* Tests that {@link PrivateSpaceMaintainer#lockPrivateSpace()} when PS exists and is running
|
||||||
* locks the private profile.
|
* locks the private profile.
|
||||||
|
|||||||
Reference in New Issue
Block a user