Simiplifying the Parner override definition so that it can be used

for multiple overrides

Bug: 257555083
Test: Presubmit
Change-Id: I14eb98edb19ccf109222d6806e27de707e485457
This commit is contained in:
Sunny Goyal
2022-11-14 14:30:07 -08:00
parent 1c744c996c
commit 3e58eea9da
7 changed files with 160 additions and 195 deletions

View File

@@ -16,8 +16,6 @@
package com.android.launcher3.util;
import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY;
import android.app.AppOpsManager;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
@@ -31,7 +29,6 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
import android.content.res.Resources;
import android.graphics.Rect;
import android.net.Uri;
import android.os.Build;
@@ -40,7 +37,6 @@ import android.os.PatternMatcher;
import android.os.UserHandle;
import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
import android.widget.Toast;
import androidx.annotation.NonNull;
@@ -295,25 +291,6 @@ public class PackageManagerHelper {
}
}
/**
* Finds a system apk which had a broadcast receiver listening to a particular action.
* @param action intent action used to find the apk
* @return a pair of apk package name and the resources.
*/
public static Pair<String, Resources> findSystemApk(String action, PackageManager pm) {
final Intent intent = new Intent(action);
for (ResolveInfo info : pm.queryBroadcastReceivers(intent, MATCH_SYSTEM_ONLY)) {
final String packageName = info.activityInfo.packageName;
try {
final Resources res = pm.getResourcesForApplication(packageName);
return Pair.create(packageName, res);
} catch (NameNotFoundException e) {
Log.w(TAG, "Failed to find resources for " + packageName);
}
}
return null;
}
/**
* Returns true if the intent is a valid launch intent for a launcher activity of an app.
* This is used to identify shortcuts which are different from the ones exposed by the