Merge "Allows to launch only authenticator owned activities" into rvc-dev
diff --git a/res/layout/preference_multiline_title.xml b/res/layout/preference_multiline_title.xml
index ae93ead..f64b27f 100644
--- a/res/layout/preference_multiline_title.xml
+++ b/res/layout/preference_multiline_title.xml
@@ -36,6 +36,7 @@
android:layout_height="wrap_content"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Subhead"
android:textColor="?android:attr/textColorPrimary"
+ android:textAlignment="center"
android:ellipsize="marquee"
android:fadingEdge="horizontal" />
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 897cfea..366254f 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -11818,11 +11818,6 @@
<!-- Summary for the top level Privacy Settings [CHAR LIMIT=NONE]-->
<string name="privacy_dashboard_summary">Permissions, account activity, personal data</string>
- <!-- UI debug setting: show media player on quick settings title [CHAR LIMIT=60] -->
- <string name="quick_settings_media_player">Media resumption</string>
- <!-- UI debug setting: show media player on quick settings summary [CHAR_LIMIT=NONE] -->
- <string name="quick_settings_media_player_summary">Shows and persists media player in Quick Settings. Requires reboot.</string>
-
<!-- Label for button in contextual card for users to remove the card [CHAR LIMIT=30] -->
<string name="contextual_card_dismiss_remove">Remove</string>
<!-- Label for button in contextual card for users to keep the card [CHAR LIMIT=30] -->
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index 2420b03..cce0a37 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -527,11 +527,6 @@
android:title="@string/usb_audio_disable_routing"
android:summary="@string/usb_audio_disable_routing_summary" />
- <SwitchPreference
- android:key="quick_settings_media_player"
- android:title="@string/quick_settings_media_player"
- android:summary="@string/quick_settings_media_player_summary" />
-
</PreferenceCategory>
<PreferenceCategory
diff --git a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
index f8b64fb..6b0759a 100644
--- a/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleFeaturePreferenceFragment.java
@@ -30,7 +30,6 @@
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
-import android.os.Handler;
import android.os.UserHandle;
import android.provider.Settings;
import android.text.Html;
@@ -97,7 +96,6 @@
private int mUserShortcutTypes = UserShortcutType.EMPTY;
private CheckBox mSoftwareTypeCheckBox;
private CheckBox mHardwareTypeCheckBox;
- private SettingsContentObserver mSettingsContentObserver;
// For html description of accessibility service, must follow the rule, such as
// <img src="R.drawable.fileName"/>, a11y settings will get the resources successfully.
@@ -135,17 +133,6 @@
removeDialog(DialogEnums.EDIT_SHORTCUT);
mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
};
-
- final List<String> shortcutFeatureKeys = new ArrayList<>();
- shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS);
- shortcutFeatureKeys.add(Settings.Secure.ACCESSIBILITY_SHORTCUT_TARGET_SERVICE);
- mSettingsContentObserver = new SettingsContentObserver(new Handler(), shortcutFeatureKeys) {
- @Override
- public void onChange(boolean selfChange, Uri uri) {
- updateShortcutPreferenceData();
- updateShortcutPreference();
- }
- };
return super.onCreateView(inflater, container, savedInstanceState);
}
@@ -242,7 +229,6 @@
final AccessibilityManager am = getPrefContext().getSystemService(
AccessibilityManager.class);
am.addTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
- mSettingsContentObserver.register(getContentResolver());
updateShortcutPreferenceData();
updateShortcutPreference();
}
@@ -252,7 +238,6 @@
final AccessibilityManager am = getPrefContext().getSystemService(
AccessibilityManager.class);
am.removeTouchExplorationStateChangeListener(mTouchExplorationStateChangeListener);
- mSettingsContentObserver.unregister(getContentResolver());
super.onPause();
}
@@ -633,7 +618,7 @@
getShortcutTypeSummary(getPrefContext()));
}
- protected void updateShortcutPreferenceData() {
+ private void updateShortcutPreferenceData() {
if (mComponentName == null) {
return;
}
@@ -666,7 +651,7 @@
mShortcutPreference.setTitle(title);
}
- protected void updateShortcutPreference() {
+ private void updateShortcutPreference() {
if (mComponentName == null) {
return;
}
diff --git a/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java
index 52f8f71..23fb153 100644
--- a/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/ToggleScreenMagnificationPreferenceFragment.java
@@ -467,8 +467,7 @@
showDialog(DialogEnums.MAGNIFICATION_EDIT_SHORTCUT);
}
- @Override
- protected void updateShortcutPreferenceData() {
+ private void updateShortcutPreferenceData() {
// Get the user shortcut type from settings provider.
mUserShortcutType = getUserShortcutTypeFromSettings(getPrefContext());
if (mUserShortcutType != UserShortcutType.EMPTY) {
@@ -490,8 +489,7 @@
mShortcutPreference.setTitle(title);
}
- @Override
- protected void updateShortcutPreference() {
+ private void updateShortcutPreference() {
final int shortcutTypes = getUserShortcutTypes(getPrefContext(), UserShortcutType.SOFTWARE);
mShortcutPreference.setChecked(
hasMagnificationValuesInSettings(getPrefContext(), shortcutTypes));
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index 6492560..eaccebf 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -496,7 +496,6 @@
controllers.add(new DebugNonRectClipOperationsPreferenceController(context));
controllers.add(new ForceDarkPreferenceController(context));
controllers.add(new EnableBlursPreferenceController(context));
- controllers.add(new QuickSettingsMediaPlayerPreferenceController(context));
controllers.add(new ForceMSAAPreferenceController(context));
controllers.add(new HardwareOverlaysPreferenceController(context));
controllers.add(new SimulateColorSpacePreferenceController(context));
diff --git a/src/com/android/settings/development/QuickSettingsMediaPlayerPreferenceController.java b/src/com/android/settings/development/QuickSettingsMediaPlayerPreferenceController.java
deleted file mode 100644
index 47f3adc..0000000
--- a/src/com/android/settings/development/QuickSettingsMediaPlayerPreferenceController.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2020 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.development;
-
-import android.content.Context;
-import android.provider.Settings;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.preference.Preference;
-import androidx.preference.SwitchPreference;
-
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settingslib.development.DeveloperOptionsPreferenceController;
-
-/**
- * Controls whether the media player should be visible in quick settings.
- */
-public class QuickSettingsMediaPlayerPreferenceController extends
- DeveloperOptionsPreferenceController implements Preference.OnPreferenceChangeListener,
- PreferenceControllerMixin {
- private static final String PREFERENCE_KEY = "quick_settings_media_player";
- @VisibleForTesting
- static final String SETTING_NAME = Settings.Global.SHOW_MEDIA_ON_QUICK_SETTINGS;
- @VisibleForTesting
- static final int SETTING_VALUE_ON = 1;
- @VisibleForTesting
- static final int SETTING_VALUE_OFF = 0;
-
- public QuickSettingsMediaPlayerPreferenceController(Context context) {
- super(context);
- }
-
- @Override
- public String getPreferenceKey() {
- return PREFERENCE_KEY;
- }
-
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- final boolean isEnabled = (Boolean) newValue;
- Settings.Global.putInt(mContext.getContentResolver(), SETTING_NAME,
- isEnabled ? SETTING_VALUE_ON : SETTING_VALUE_OFF);
- return true;
- }
-
- @Override
- public void updateState(Preference preference) {
- final int mode = Settings.Global.getInt(mContext.getContentResolver(), SETTING_NAME,
- SETTING_VALUE_OFF);
- ((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
- }
-
- @Override
- protected void onDeveloperOptionsSwitchDisabled() {
- super.onDeveloperOptionsSwitchDisabled();
- Settings.Global.putInt(mContext.getContentResolver(), SETTING_NAME, SETTING_VALUE_OFF);
- ((SwitchPreference) mPreference).setChecked(false);
- }
-}
diff --git a/src/com/android/settings/display/NightDisplayAutoModePreferenceController.java b/src/com/android/settings/display/NightDisplayAutoModePreferenceController.java
index ef11e00..fb2dbc3 100644
--- a/src/com/android/settings/display/NightDisplayAutoModePreferenceController.java
+++ b/src/com/android/settings/display/NightDisplayAutoModePreferenceController.java
@@ -74,7 +74,7 @@
if (String.valueOf(ColorDisplayManager.AUTO_MODE_TWILIGHT).equals(newValue)
&& !mLocationManager.isLocationEnabled()) {
TwilightLocationDialog.show(mContext);
- return true;
+ return false;
}
return mColorDisplayManager.setNightDisplayAutoMode(Integer.parseInt((String) newValue));
}
diff --git a/src/com/android/settings/display/darkmode/DarkModeScheduleSelectorController.java b/src/com/android/settings/display/darkmode/DarkModeScheduleSelectorController.java
index 2ac9a9f..6acaf82 100644
--- a/src/com/android/settings/display/darkmode/DarkModeScheduleSelectorController.java
+++ b/src/com/android/settings/display/darkmode/DarkModeScheduleSelectorController.java
@@ -33,7 +33,7 @@
*/
public class DarkModeScheduleSelectorController extends BasePreferenceController
implements Preference.OnPreferenceChangeListener {
- private static final String TAG = DarkModeScheduleSelectorController.class.getSimpleName();
+
private final UiModeManager mUiModeManager;
private PowerManager mPowerManager;
private DropDownPreference mPreference;
@@ -51,6 +51,7 @@
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
mPreference = screen.findPreference(getPreferenceKey());
+ init();
}
@Override
@@ -58,8 +59,7 @@
return BasePreferenceController.AVAILABLE;
}
- @Override
- public final void updateState(Preference preference) {
+ private void init() {
final boolean batterySaver = mPowerManager.isPowerSaveMode();
mPreference.setEnabled(!batterySaver);
mCurrentMode = getCurrentMode();
@@ -87,25 +87,25 @@
if (newMode == mCurrentMode) {
return false;
}
- if (newMode == mPreference.findIndexOfValue(
+ mCurrentMode = newMode;
+ if (mCurrentMode == mPreference.findIndexOfValue(
mContext.getString(R.string.dark_ui_auto_mode_never))) {
boolean active = (mContext.getResources().getConfiguration().uiMode
& Configuration.UI_MODE_NIGHT_YES) != 0;
int mode = active ? UiModeManager.MODE_NIGHT_YES
: UiModeManager.MODE_NIGHT_NO;
mUiModeManager.setNightMode(mode);
- } else if (newMode == mPreference.findIndexOfValue(
+ } else if (mCurrentMode == mPreference.findIndexOfValue(
mContext.getString(R.string.dark_ui_auto_mode_auto))) {
if (!mLocationManager.isLocationEnabled()) {
TwilightLocationDialog.show(mContext);
- return true;
+ return false;
}
mUiModeManager.setNightMode(UiModeManager.MODE_NIGHT_AUTO);
- } else if (newMode == mPreference.findIndexOfValue(
+ } else if (mCurrentMode == mPreference.findIndexOfValue(
mContext.getString(R.string.dark_ui_auto_mode_custom))) {
mUiModeManager.setNightMode(UiModeManager.MODE_NIGHT_CUSTOM);
}
- mCurrentMode = newMode;
return true;
}
}
diff --git a/src/com/android/settings/network/telephony/Enhanced4gLteSliceHelper.java b/src/com/android/settings/network/telephony/Enhanced4gLteSliceHelper.java
index 52fc99c..9e46158 100644
--- a/src/com/android/settings/network/telephony/Enhanced4gLteSliceHelper.java
+++ b/src/com/android/settings/network/telephony/Enhanced4gLteSliceHelper.java
@@ -18,6 +18,8 @@
import static android.app.slice.Slice.EXTRA_TOGGLE_STATE;
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
+
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
@@ -274,6 +276,7 @@
*/
private PendingIntent getActivityIntent(String action) {
final Intent intent = new Intent(action);
+ intent.setPackage(SETTINGS_PACKAGE_NAME);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
return PendingIntent.getActivity(mContext, 0 /* requestCode */, intent, 0 /* flags */);
}
diff --git a/src/com/android/settings/wifi/addappnetworks/AddAppNetworksFragment.java b/src/com/android/settings/wifi/addappnetworks/AddAppNetworksFragment.java
index 008df24..a48358f 100644
--- a/src/com/android/settings/wifi/addappnetworks/AddAppNetworksFragment.java
+++ b/src/com/android/settings/wifi/addappnetworks/AddAppNetworksFragment.java
@@ -124,6 +124,9 @@
List<Integer> mResultCodeArrayList;
@VisibleForTesting
WifiPickerTracker mWifiPickerTracker;
+ // Worker thread used for WifiPickerTracker work
+ @VisibleForTesting
+ HandlerThread mWorkerThread;
private boolean mIsSingleNetwork;
private boolean mAnyNetworkSavedSuccess;
@@ -133,8 +136,6 @@
private UiConfigurationItemAdapter mUiConfigurationItemAdapter;
private WifiManager.ActionListener mSaveListener;
private WifiManager mWifiManager;
- // Worker thread used for WifiPickerTracker work
- private HandlerThread mWorkerThread;
private final Handler mHandler = new Handler() {
@Override
@@ -203,6 +204,13 @@
}
@Override
+ public void onDestroy() {
+ mWorkerThread.quit();
+
+ super.onDestroy();
+ }
+
+ @Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
diff --git a/src/com/android/settings/wifi/calling/WifiCallingSliceHelper.java b/src/com/android/settings/wifi/calling/WifiCallingSliceHelper.java
index 958db7e..26d742d 100644
--- a/src/com/android/settings/wifi/calling/WifiCallingSliceHelper.java
+++ b/src/com/android/settings/wifi/calling/WifiCallingSliceHelper.java
@@ -20,6 +20,7 @@
import static com.android.settings.slices.CustomSliceRegistry.WIFI_CALLING_PREFERENCE_URI;
import static com.android.settings.slices.CustomSliceRegistry.WIFI_CALLING_URI;
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
import android.app.PendingIntent;
import android.content.ComponentName;
@@ -554,6 +555,7 @@
*/
private PendingIntent getActivityIntent(String action) {
final Intent intent = new Intent(action);
+ intent.setPackage(SETTINGS_PACKAGE_NAME);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
return PendingIntent.getActivity(mContext, 0 /* requestCode */, intent, 0 /* flags */);
}
diff --git a/tests/robotests/src/com/android/settings/development/QuickSettingsMediaPlayerPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/QuickSettingsMediaPlayerPreferenceControllerTest.java
deleted file mode 100644
index 10eed2f..0000000
--- a/tests/robotests/src/com/android/settings/development/QuickSettingsMediaPlayerPreferenceControllerTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2020 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.development;
-
-import static com.android.settings.development.QuickSettingsMediaPlayerPreferenceController.SETTING_NAME;
-import static com.android.settings.development.QuickSettingsMediaPlayerPreferenceController.SETTING_VALUE_OFF;
-import static com.android.settings.development.QuickSettingsMediaPlayerPreferenceController.SETTING_VALUE_ON;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.content.Context;
-import android.provider.Settings;
-
-import androidx.preference.PreferenceScreen;
-import androidx.preference.SwitchPreference;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnit;
-import org.mockito.junit.MockitoRule;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-
-@RunWith(RobolectricTestRunner.class)
-public class QuickSettingsMediaPlayerPreferenceControllerTest {
- @Mock
- private SwitchPreference mPreference;
- @Mock
- private PreferenceScreen mPreferenceScreen;
- @Rule
- public MockitoRule mMockitoRule = MockitoJUnit.rule();
-
- private Context mContext;
- private QuickSettingsMediaPlayerPreferenceController mController;
-
- @Before
- public void setup() {
- mContext = RuntimeEnvironment.application;
- mController = new QuickSettingsMediaPlayerPreferenceController(mContext);
- when(mPreferenceScreen.findPreference(mController.getPreferenceKey()))
- .thenReturn(mPreference);
- mController.displayPreference(mPreferenceScreen);
- }
-
- @Test
- public void onPreferenceChanged_turnOnPreference_shouldEnable() {
- mController.onPreferenceChange(mPreference, true /* new value */);
-
- final int mode = Settings.Global.getInt(mContext.getContentResolver(),
- SETTING_NAME, -1 /* default */);
-
- assertThat(mode).isEqualTo(SETTING_VALUE_ON);
- }
-
- @Test
- public void onPreferenceChanged_turnOffPreference_shouldDisable() {
- mController.onPreferenceChange(mPreference, false /* new value */);
-
- final int mode = Settings.Global.getInt(mContext.getContentResolver(),
- SETTING_NAME, -1 /* default */);
-
- assertThat(mode).isEqualTo(SETTING_VALUE_OFF);
- }
-
- @Test
- public void updateState_settingEnabled_preferenceShouldBeChecked() {
- Settings.Global.putInt(mContext.getContentResolver(), SETTING_NAME, SETTING_VALUE_ON);
- mController.updateState(mPreference);
-
- verify(mPreference).setChecked(true);
- }
-
- @Test
- public void updateState_settingDisabled_preferenceShouldNotBeChecked() {
- Settings.Global.putInt(mContext.getContentResolver(), SETTING_NAME, SETTING_VALUE_OFF);
- mController.updateState(mPreference);
-
- verify(mPreference).setChecked(false);
- }
-
- @Test
- public void onDeveloperOptionsSwitchDisabled_shouldDisable() {
- mController.onDeveloperOptionsSwitchDisabled();
- final int mode = Settings.Global.getInt(mContext.getContentResolver(),
- SETTING_NAME, -1 /* default */);
-
- assertThat(mode).isEqualTo(SETTING_VALUE_OFF);
- verify(mPreference).setEnabled(false);
- verify(mPreference).setChecked(false);
- }
-}
diff --git a/tests/robotests/src/com/android/settings/network/telephony/Enhanced4gLteSliceHelperTest.java b/tests/robotests/src/com/android/settings/network/telephony/Enhanced4gLteSliceHelperTest.java
index 50446ad..416e2f0 100644
--- a/tests/robotests/src/com/android/settings/network/telephony/Enhanced4gLteSliceHelperTest.java
+++ b/tests/robotests/src/com/android/settings/network/telephony/Enhanced4gLteSliceHelperTest.java
@@ -20,6 +20,7 @@
import static android.app.slice.Slice.HINT_TITLE;
import static android.app.slice.SliceItem.FORMAT_TEXT;
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.anyInt;
@@ -248,6 +249,7 @@
private PendingIntent getActivityIntent(String action) {
final Intent intent = new Intent(action);
+ intent.setPackage(SETTINGS_PACKAGE_NAME);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
return PendingIntent.getActivity(mContext, 0 /* requestCode */, intent, 0 /* flags */);
}
diff --git a/tests/robotests/src/com/android/settings/wifi/addappnetworks/AddAppNetworksFragmentTest.java b/tests/robotests/src/com/android/settings/wifi/addappnetworks/AddAppNetworksFragmentTest.java
index ac25689..3f02e2e 100644
--- a/tests/robotests/src/com/android/settings/wifi/addappnetworks/AddAppNetworksFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/addappnetworks/AddAppNetworksFragmentTest.java
@@ -19,7 +19,9 @@
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.app.settings.SettingsEnums;
@@ -27,6 +29,7 @@
import android.net.wifi.WifiManager;
import android.net.wifi.WifiNetworkSuggestion;
import android.os.Bundle;
+import android.os.HandlerThread;
import android.os.Parcelable;
import android.provider.Settings;
import android.widget.TextView;
@@ -247,6 +250,19 @@
SCANED_LEVEL0);
}
+ @Test
+ public void onDestroy_quitWorkerThread() {
+ mAddAppNetworksFragment.mWorkerThread = mock(HandlerThread.class);
+
+ try {
+ mAddAppNetworksFragment.onDestroy();
+ } catch (IllegalArgumentException e) {
+ // Ignore the exception from super class.
+ }
+
+ verify(mAddAppNetworksFragment.mWorkerThread).quit();
+ }
+
private void setUpOneScannedNetworkWithScanedLevel4() {
final ArrayList list = new ArrayList<>();
list.add(mMockWifiEntry);
diff --git a/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSliceHelperTest.java b/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSliceHelperTest.java
index 0013234..0b9ef55 100644
--- a/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSliceHelperTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/calling/WifiCallingSliceHelperTest.java
@@ -20,6 +20,7 @@
import static android.app.slice.Slice.HINT_TITLE;
import static android.app.slice.SliceItem.FORMAT_TEXT;
+import static com.android.settings.Utils.SETTINGS_PACKAGE_NAME;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.anyInt;
@@ -400,6 +401,7 @@
private PendingIntent getActivityIntent(String action) {
final Intent intent = new Intent(action);
+ intent.setPackage(SETTINGS_PACKAGE_NAME);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
return PendingIntent.getActivity(mContext, 0 /* requestCode */, intent, 0 /* flags */);
}