[core] Fix settings on Android 12 (#1254)
This commit is contained in:
parent
1eab21c3fc
commit
64154f8160
|
|
@ -28,6 +28,7 @@ import android.app.Notification;
|
||||||
import android.app.NotificationChannel;
|
import android.app.NotificationChannel;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
|
import android.content.AttributionSource;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
|
@ -41,6 +42,7 @@ import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.drawable.Icon;
|
import android.graphics.drawable.Icon;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.HandlerThread;
|
import android.os.HandlerThread;
|
||||||
|
|
@ -680,9 +682,17 @@ public class LSPManagerService extends ILSPManagerService.Stub {
|
||||||
try {
|
try {
|
||||||
var contentProvider = ActivityManagerService.getContentProvider("settings", 0);
|
var contentProvider = ActivityManagerService.getContentProvider("settings", 0);
|
||||||
if (contentProvider != null) {
|
if (contentProvider != null) {
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||||
|
try {
|
||||||
|
contentProvider.call(new AttributionSource.Builder(1000).setPackageName("android").build(),
|
||||||
|
"settings", "PUT_global", "show_hidden_icon_apps_enabled", args);
|
||||||
|
return;
|
||||||
|
} catch (NoSuchMethodError ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
contentProvider.call("android", null, "settings", "PUT_global", "show_hidden_icon_apps_enabled", args);
|
contentProvider.call("android", null, "settings", "PUT_global", "show_hidden_icon_apps_enabled", args);
|
||||||
}
|
}
|
||||||
} catch (RemoteException | NullPointerException e) {
|
} catch (Throwable e) {
|
||||||
Log.w(TAG, "setHiddenIcon: ", e);
|
Log.w(TAG, "setHiddenIcon: ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
package android.content;
|
||||||
|
|
||||||
|
public class AttributionSource {
|
||||||
|
}
|
||||||
|
|
@ -4,8 +4,13 @@ import android.os.Bundle;
|
||||||
import android.os.IInterface;
|
import android.os.IInterface;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
|
|
||||||
|
import androidx.annotation.RequiresApi;
|
||||||
|
|
||||||
public interface IContentProvider extends IInterface {
|
public interface IContentProvider extends IInterface {
|
||||||
Bundle call(String callingPkg, String attributionTag, String authority,
|
Bundle call(String callingPkg, String attributionTag, String authority,
|
||||||
String method, String arg, Bundle extras) throws RemoteException;
|
String method, String arg, Bundle extras) throws RemoteException;
|
||||||
|
|
||||||
|
@RequiresApi(31)
|
||||||
|
Bundle call(AttributionSource attributionSource, String authority,
|
||||||
|
String method, String arg, Bundle extras) throws RemoteException;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue