19.1: Picks + Churn

Signed-off-by: Tavi <tavi@divested.dev>
This commit is contained in:
Tavi 2024-09-08 13:56:09 -04:00
parent d3a6439cca
commit 6bca4eaf77
No known key found for this signature in database
GPG Key ID: E599F62ECBAEAF2E
3 changed files with 1 additions and 153 deletions

View File

@ -1,150 +0,0 @@
diff --git a/src/com/android/settings/search/SearchFeatureProvider.java b/src/com/android/settings/search/SearchFeatureProvider.java
index 1785361d3b..c4141e91f7 100644
--- a/src/com/android/settings/search/SearchFeatureProvider.java
+++ b/src/com/android/settings/search/SearchFeatureProvider.java
@@ -56,7 +56,7 @@ public interface SearchFeatureProvider {
* @throws IllegalArgumentException when caller is null
* @throws SecurityException when caller is not allowed to launch search result page
*/
- void verifyLaunchSearchResultPageCaller(Context context, @NonNull ComponentName caller)
+ void verifyLaunchSearchResultPageCaller(@NonNull Context context, @NonNull String callerPackage)
throws SecurityException, IllegalArgumentException;
/**
diff --git a/src/com/android/settings/search/SearchFeatureProviderImpl.java b/src/com/android/settings/search/SearchFeatureProviderImpl.java
index 6f90970905..3a62ddfb67 100644
--- a/src/com/android/settings/search/SearchFeatureProviderImpl.java
+++ b/src/com/android/settings/search/SearchFeatureProviderImpl.java
@@ -17,13 +17,14 @@
package com.android.settings.search;
-import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.provider.Settings;
import android.text.TextUtils;
+import androidx.annotation.NonNull;
+
import com.android.settingslib.search.SearchIndexableResources;
import com.android.settingslib.search.SearchIndexableResourcesMobile;
@@ -32,21 +33,18 @@ import com.android.settingslib.search.SearchIndexableResourcesMobile;
*/
public class SearchFeatureProviderImpl implements SearchFeatureProvider {
- private static final String TAG = "SearchFeatureProvider";
-
private SearchIndexableResources mSearchIndexableResources;
@Override
- public void verifyLaunchSearchResultPageCaller(Context context, ComponentName caller) {
- if (caller == null) {
+ public void verifyLaunchSearchResultPageCaller(@NonNull Context context,
+ @NonNull String callerPackage) {
+ if (TextUtils.isEmpty(callerPackage)) {
throw new IllegalArgumentException("ExternalSettingsTrampoline intents "
+ "must be called with startActivityForResult");
}
- final String packageName = caller.getPackageName();
- final boolean isSettingsPackage = TextUtils.equals(packageName, context.getPackageName())
- || TextUtils.equals(getSettingsIntelligencePkgName(context), packageName);
- final boolean isAllowlistedPackage =
- isSignatureAllowlisted(context, caller.getPackageName());
+ final boolean isSettingsPackage = TextUtils.equals(callerPackage, context.getPackageName())
+ || TextUtils.equals(getSettingsIntelligencePkgName(context), callerPackage);
+ final boolean isAllowlistedPackage = isSignatureAllowlisted(context, callerPackage);
if (isSettingsPackage || isAllowlistedPackage) {
return;
}
diff --git a/src/com/android/settings/search/SearchResultTrampoline.java b/src/com/android/settings/search/SearchResultTrampoline.java
index 8b041b67f8..6580c682fa 100644
--- a/src/com/android/settings/search/SearchResultTrampoline.java
+++ b/src/com/android/settings/search/SearchResultTrampoline.java
@@ -20,7 +20,6 @@ import static com.android.settings.SettingsActivity.EXTRA_SHOW_FRAGMENT_ARGUMENT
import static com.android.settings.SettingsActivity.EXTRA_SHOW_FRAGMENT_TAB;
import android.app.Activity;
-import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.provider.Settings;
@@ -48,11 +47,11 @@ public class SearchResultTrampoline extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- final ComponentName callingActivity = getCallingActivity();
+ final String callerPackage = getLaunchedFromPackage();
// First make sure caller has privilege to launch a search result page.
FeatureFactory.getFactory(this)
.getSearchFeatureProvider()
- .verifyLaunchSearchResultPageCaller(this, callingActivity);
+ .verifyLaunchSearchResultPageCaller(this, callerPackage);
// Didn't crash, proceed and launch the result as a subsetting.
Intent intent = getIntent();
final String highlightMenuKey = intent.getStringExtra(
@@ -96,7 +95,7 @@ public class SearchResultTrampoline extends Activity {
if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(this)) {
startActivity(intent);
- } else if (isSettingsIntelligence(callingActivity)) {
+ } else if (isSettingsIntelligence(callerPackage)) {
// Register SplitPairRule for SubSettings, set clearTop false to prevent unexpected back
// navigation behavior.
ActivityEmbeddingRulesController.registerSubSettingsPairRule(this,
@@ -122,9 +121,9 @@ public class SearchResultTrampoline extends Activity {
finish();
}
- private boolean isSettingsIntelligence(ComponentName callingActivity) {
- return callingActivity != null && TextUtils.equals(
- callingActivity.getPackageName(),
+ private boolean isSettingsIntelligence(String callerPackage) {
+ return TextUtils.equals(
+ callerPackage,
FeatureFactory.getFactory(this).getSearchFeatureProvider()
.getSettingsIntelligencePkgName(this));
}
diff --git a/tests/robotests/src/com/android/settings/search/SearchFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/search/SearchFeatureProviderImplTest.java
index 5de57b6c95..dec99028e8 100644
--- a/tests/robotests/src/com/android/settings/search/SearchFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/search/SearchFeatureProviderImplTest.java
@@ -20,7 +20,6 @@ package com.android.settings.search;
import static com.google.common.truth.Truth.assertThat;
import android.app.settings.SettingsEnums;
-import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ResolveInfo;
@@ -127,20 +126,22 @@ public class SearchFeatureProviderImplTest {
@Test(expected = SecurityException.class)
public void verifyLaunchSearchResultPageCaller_badCaller_shouldCrash() {
- final ComponentName cn = new ComponentName("pkg", "class");
- mProvider.verifyLaunchSearchResultPageCaller(mActivity, cn);
+ final String packageName = "pkg";
+
+ mProvider.verifyLaunchSearchResultPageCaller(mActivity, packageName);
}
@Test
public void verifyLaunchSearchResultPageCaller_settingsCaller_shouldNotCrash() {
- final ComponentName cn = new ComponentName(mActivity.getPackageName(), "class");
- mProvider.verifyLaunchSearchResultPageCaller(mActivity, cn);
+ final String packageName = mActivity.getPackageName();
+
+ mProvider.verifyLaunchSearchResultPageCaller(mActivity, packageName);
}
@Test
public void verifyLaunchSearchResultPageCaller_settingsIntelligenceCaller_shouldNotCrash() {
final String packageName = mProvider.getSettingsIntelligencePkgName(mActivity);
- final ComponentName cn = new ComponentName(packageName, "class");
- mProvider.verifyLaunchSearchResultPageCaller(mActivity, cn);
+
+ mProvider.verifyLaunchSearchResultPageCaller(mActivity, packageName);
}
}

View File

@ -68,7 +68,7 @@ patchWorkspaceReal() {
source build/envsetup.sh;
#repopick -ift twelve-bt-sbc-hd-dualchannel;
repopick -it S_asb_2024-08;
repopick -it S_asb_2024-09;
sh "$DOS_SCRIPTS/Patch.sh";
sh "$DOS_SCRIPTS_COMMON/Enable_Verity.sh";

View File

@ -95,7 +95,6 @@ applyPatch "$DOS_PATCHES_COMMON/android_build/0001-verity-openssl3.patch"; #Fix
sed -i '75i$(my_res_package): PRIVATE_AAPT_FLAGS += --auto-add-overlay' core/aapt2.mk; #Enable auto-add-overlay for packages, this allows the vendor overlay to easily work across all branches.
awk -i inplace '!/updatable_apex.mk/' target/product/generic_system.mk; #Disable APEX
sed -i 's/PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION := 23/PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION := 28/' core/version_defaults.mk; #Set the minimum supported target SDK to Pie (GrapheneOS)
sed -i 's/2024-07-05/2024-08-05/' core/version_defaults.mk; #Bump Security String #S_asb_2024-08
fi;
if enterAndClear "build/soong"; then
@ -307,7 +306,6 @@ applyPatch "$DOS_PATCHES/android_packages_apps_Nfc/0001-constify_JNINativeMethod
fi;
if enterAndClear "packages/apps/Settings"; then
applyPatch "$DOS_PATCHES/android_packages_apps_Settings/316891059-19.patch"; #x-asb_2024-05 Replace getCallingActivity() with getLaunchedFromPackage()
applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0004-Private_DNS.patch"; #More 'Private DNS' options (heavily based off of a CalyxOS patch)
applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0005-Automatic_Reboot.patch"; #Timeout for reboot (GrapheneOS)
applyPatch "$DOS_PATCHES/android_packages_apps_Settings/0006-Bluetooth_Timeout.patch"; #Timeout for Bluetooth (CalyxOS)