This commit is contained in:
Howard Wu 2021-11-08 03:26:08 +08:00 committed by GitHub
parent 971bcc6946
commit 59b59ab69d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 5 deletions

View File

@ -675,15 +675,18 @@ public class LSPManagerService extends ILSPManagerService.Stub {
try {
var contentProvider = ActivityManagerService.getContentProvider("settings", 0);
if (contentProvider != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
try {
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
contentProvider.call(new AttributionSource.Builder(1000).setPackageName("android").build(),
"settings", "PUT_global", "show_hidden_icon_apps_enabled", args);
return;
} catch (NoSuchMethodError ignored) {
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
contentProvider.call("android", null, "settings", "PUT_global", "show_hidden_icon_apps_enabled", args);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
contentProvider.call("android", "settings", "PUT_global", "show_hidden_icon_apps_enabled", args);
}
} catch (NoSuchMethodError e) {
Log.w(TAG, "setHiddenIcon: ", e);
}
contentProvider.call("android", null, "settings", "PUT_global", "show_hidden_icon_apps_enabled", args);
}
} catch (Throwable e) {
Log.w(TAG, "setHiddenIcon: ", e);

View File

@ -7,6 +7,11 @@ import android.os.RemoteException;
import androidx.annotation.RequiresApi;
public interface IContentProvider extends IInterface {
@RequiresApi(29)
Bundle call(String callingPkg, String authority, String method,
String arg, Bundle extras) throws RemoteException;
@RequiresApi(30)
Bundle call(String callingPkg, String attributionTag, String authority,
String method, String arg, Bundle extras) throws RemoteException;