Skip to content

Commit eff7f58

Browse files
committed
Update hidden API from Android 16 [1/2]
Signed-off-by: Muntashir Al-Islam <muntashirakon@riseup.net>
1 parent 02c1d9a commit eff7f58

42 files changed

Lines changed: 441 additions & 688 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/src/main/java/io/github/muntashirakon/AppManager/compat/PermissionCompat.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,12 +456,9 @@ public static PermissionInfo getPermissionInfo(String permissionName, String pac
456456
} else return pm.getPermissionInfo(permissionName, flags);
457457
}
458458

459-
@SuppressWarnings("deprecation")
460459
@NonNull
461460
public static PermissionGroupInfo getPermissionGroupInfo(String groupName, int flags) throws RemoteException {
462-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
463-
return getPermissionManager().getPermissionGroupInfo(groupName, flags);
464-
} else return PackageManagerCompat.getPackageManager().getPermissionGroupInfo(groupName, flags);
461+
return PackageManagerCompat.getPackageManager().getPermissionGroupInfo(groupName, flags);
465462
}
466463

467464
@SuppressWarnings("deprecation")

app/src/main/java/io/github/muntashirakon/AppManager/compat/SubscriptionManagerCompat.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static List<SubscriptionInfo> getActiveSubscriptionInfoList() {
3535
try {
3636
return sub.getActiveSubscriptionInfoList(callingPackage, null);
3737
} catch (NoSuchMethodError e) {
38-
// Google Pixel
38+
// Android 14 r50
3939
return sub.getActiveSubscriptionInfoList(callingPackage, null, true);
4040
}
4141
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {

hiddenapi/src/main/java/android/app/AppOpsManagerHidden.java

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class AppOpsManagerHidden {
3737
* The lower the UID state the more important the UID is for the user.
3838
*/
3939
@RequiresApi(Build.VERSION_CODES.Q)
40-
public static final int UID_STATE_FOREGROUND_SERVICE_LOCATION = 300;
40+
public static /*final*/ int UID_STATE_FOREGROUND_SERVICE_LOCATION = 300;
4141

4242
/**
4343
* Uid state: The UID is running a foreground service. The lower the UID
@@ -179,17 +179,11 @@ public class AppOpsManagerHidden {
179179
* Access all external storage
180180
*/
181181
public static /*final*/ int OP_MANAGE_EXTERNAL_STORAGE = 92;
182-
public static /*final*/ int _NUM_OP = 121;
182+
public static /*final*/ int _NUM_OP = 163;
183183

184184
public static /*final*/ int MIUI_OP_START = 10000;
185185
public static /*final*/ int MIUI_OP_END = 10040;
186186

187-
/**
188-
* This maps each operation to the public string constant for it.
189-
* If it doesn't have a public string constant, it maps to null.
190-
*/
191-
private static String[] sOpToString = HiddenUtil.throwUOE();
192-
193187
/**
194188
* Retrieve the op switch that controls the given operation.
195189
*/
@@ -392,7 +386,7 @@ public long getTime() {
392386
}
393387

394388
/**
395-
* @deprecated Removed in Android 10 (Q)
389+
* @deprecated Replaced in Android 10 (Q) with {@link #getLastAccessTime(int)}
396390
*/
397391
@RequiresApi(Build.VERSION_CODES.P)
398392
@Deprecated
@@ -406,7 +400,7 @@ public long getLastAccessTime(int flags) {
406400
}
407401

408402
/**
409-
* @deprecated Removed in Android 10 (Q)
403+
* @deprecated Replaced in Android 10 (Q) with {@link #getLastAccessForegroundTime(int)}
410404
*/
411405
@RequiresApi(Build.VERSION_CODES.P)
412406
public long getLastAccessForegroundTime() {
@@ -419,7 +413,7 @@ public long getLastAccessForegroundTime(int flags) {
419413
}
420414

421415
/**
422-
* @deprecated Removed in Android 10 (Q)
416+
* @deprecated Replaced in Android 10 (Q) with {@link #getLastAccessBackgroundTime(int)}
423417
*/
424418
@RequiresApi(Build.VERSION_CODES.P)
425419
public long getLastAccessBackgroundTime() {
@@ -445,15 +439,15 @@ public long getLastAccessTime(int fromUidState, int toUidState, int flags) {
445439
}
446440

447441
/**
448-
* @deprecated since Android 11 (R)
442+
* @deprecated since Android 11 (R). Use {@link #getLastRejectTime(int)} instead.
449443
*/
450444
@Deprecated
451445
public long getRejectTime() {
452446
return HiddenUtil.throwUOE();
453447
}
454448

455449
/**
456-
* @deprecated Removed in Android 10 (Q)
450+
* @deprecated Replaced in Android 10 (Q) with {@link #getLastRejectTime(int)}
457451
*/
458452
@RequiresApi(Build.VERSION_CODES.P)
459453
public long getLastRejectTime() {
@@ -466,7 +460,7 @@ public long getLastRejectTime(int flags) {
466460
}
467461

468462
/**
469-
* @deprecated Removed in Android 10 (Q)
463+
* @deprecated Replaced in Android 10 (Q) with {@link #getLastRejectForegroundTime(int)}
470464
*/
471465
@RequiresApi(Build.VERSION_CODES.P)
472466
public long getLastRejectForegroundTime() {
@@ -479,7 +473,7 @@ public long getLastRejectForegroundTime(int flags) {
479473
}
480474

481475
/**
482-
* @deprecated Removed in Android 10 (Q)
476+
* @deprecated Replaced in Android 10 (Q) with {@link #getLastRejectBackgroundTime(int)}
483477
*/
484478
@RequiresApi(Build.VERSION_CODES.P)
485479
public long getLastRejectBackgroundTime() {
@@ -492,7 +486,7 @@ public long getLastRejectBackgroundTime(int flags) {
492486
}
493487

494488
/**
495-
* @deprecated Removed in Android 10 (Q)
489+
* @deprecated Replaced in Android 10 (Q) with {@link #getLastRejectTime(int, int, int)}
496490
*/
497491
@RequiresApi(Build.VERSION_CODES.P)
498492
public long getLastRejectTimeFor(int uidState) {

hiddenapi/src/main/java/android/app/INotificationManager.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,18 @@ public IBinder asBinder() {
5959
@RequiresApi(Build.VERSION_CODES.O_MR1)
6060
void setNotificationListenerAccessGranted(ComponentName listener, boolean enabled) throws RemoteException;
6161

62+
@RequiresApi(Build.VERSION_CODES.S)
63+
void setNotificationListenerAccessGranted(ComponentName listener, boolean enabled, boolean userSet) throws RemoteException;
64+
6265
@RequiresApi(Build.VERSION_CODES.O_MR1)
6366
void setNotificationAssistantAccessGranted(ComponentName assistant, boolean enabled) throws RemoteException;
6467

6568
@RequiresApi(Build.VERSION_CODES.O_MR1)
6669
void setNotificationListenerAccessGrantedForUser(ComponentName listener, int userId, boolean enabled) throws RemoteException;
6770

71+
@RequiresApi(Build.VERSION_CODES.S)
72+
void setNotificationListenerAccessGrantedForUser(ComponentName listener, int userId, boolean enabled, boolean userSet) throws RemoteException;
73+
6874
@RequiresApi(Build.VERSION_CODES.O_MR1)
6975
void setNotificationAssistantAccessGrantedForUser(ComponentName assistant, int userId, boolean enabled) throws RemoteException;
7076

hiddenapi/src/main/java/android/app/IUriGrantsManager.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ public interface IUriGrantsManager extends android.os.IInterface {
4040

4141
ParceledListSlice<UriPermission> getUriPermissions(String packageName, boolean incoming, boolean persistedOnly) throws RemoteException;
4242

43+
@RequiresApi(Build.VERSION_CODES.VANILLA_ICE_CREAM)
44+
int checkGrantUriPermission_ignoreNonSystem(
45+
int sourceUid, String targetPkg, Uri uri, int modeFlags, int userId) throws RemoteException;
46+
4347
abstract class Stub extends Binder implements IUriGrantsManager {
4448
public static IUriGrantsManager asInterface(IBinder obj) {
4549
return HiddenUtil.throwUOE(obj);

hiddenapi/src/main/java/android/app/backup/IBackupManager.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ void adbBackup(int userId, ParcelFileDescriptor fd, boolean includeApks, boolean
206206
*
207207
* @deprecated Replaced by {@link #adbRestore(ParcelFileDescriptor)} in API 26 (Android O)
208208
*/
209+
@Deprecated
209210
void fullRestore(ParcelFileDescriptor fd) throws RemoteException;
210211

211212
/**

hiddenapi/src/main/java/android/app/usage/IStorageStatsManager.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ public IBinder asBinder() {
4242

4343
StorageStats queryStatsForPackage(String volumeUuid, String packageName, int userId, String callingPackage) throws RemoteException;
4444

45+
@RequiresApi(Build.VERSION_CODES.BAKLAVA)
46+
StorageStats queryArtManagedStats(String packageName, int userId, int uid) throws RemoteException;
47+
4548
StorageStats queryStatsForUid(String volumeUuid, int uid, String callingPackage) throws RemoteException;
4649

4750
StorageStats queryStatsForUser(String volumeUuid, int userId, String callingPackage) throws RemoteException;

hiddenapi/src/main/java/android/app/usage/IUsageStatsManager.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import android.os.Build;
99
import android.os.IBinder;
1010
import android.os.IInterface;
11+
import android.os.PersistableBundle;
1112
import android.os.RemoteException;
1213

1314
import androidx.annotation.RequiresApi;
@@ -29,9 +30,17 @@ public IBinder asBinder() {
2930
}
3031
}
3132

33+
/**
34+
* @deprecated Replaced in API 31 (Android S) by {@link #queryUsageStats(int, long, long, String, int)}
35+
*/
36+
@Deprecated
3237
ParceledListSlice queryUsageStats(int bucketType, long beginTime, long endTime, String callingPackage)
3338
throws RemoteException;
3439

40+
@RequiresApi(Build.VERSION_CODES.S)
41+
ParceledListSlice queryUsageStats(int bucketType, long beginTime, long endTime,
42+
String callingPackage, int userId) throws RemoteException;
43+
3544
ParceledListSlice queryConfigurationStats(int bucketType, long beginTime, long endTime, String callingPackage)
3645
throws RemoteException;
3746

@@ -52,9 +61,15 @@ UsageEvents queryEventsForUser(long beginTime, long endTime, int userId, String
5261
UsageEvents queryEventsForPackageForUser(long beginTime, long endTime, int userId, String pkg,
5362
String callingPackage) throws RemoteException;
5463

64+
@RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE) // Android 14 r50
65+
UsageEvents queryEventsWithFilter(UsageEventsQuery query, String callingPackage) throws RemoteException;
66+
5567
@RequiresApi(Build.VERSION_CODES.M)
5668
void setAppInactive(String packageName, boolean inactive, int userId) throws RemoteException;
5769

70+
@RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
71+
boolean isAppStandbyEnabled() throws RemoteException;
72+
5873
/**
5974
* @deprecated Replaced in API 30 (Android R) by {@link #isAppInactive(String, int, String)}
6075
*/
@@ -65,6 +80,10 @@ UsageEvents queryEventsForPackageForUser(long beginTime, long endTime, int userI
6580
@RequiresApi(Build.VERSION_CODES.R)
6681
boolean isAppInactive(String packageName, int userId, String callingPackage) throws RemoteException;
6782

83+
/**
84+
* @deprecated Removed in API 30 (Android R)
85+
*/
86+
@Deprecated
6887
@RequiresApi(Build.VERSION_CODES.M)
6988
void whitelistAppTemporarily(String packageName, long duration, int userId) throws RemoteException;
7089

@@ -87,6 +106,15 @@ void reportChooserSelection(String packageName, int userId, String contentType,
87106
@RequiresApi(Build.VERSION_CODES.P)
88107
void setAppStandbyBuckets(ParceledListSlice appBuckets, int userId) throws RemoteException;
89108

109+
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
110+
int getAppMinStandbyBucket(String packageName, String callingPackage, int userId) throws RemoteException;
111+
112+
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
113+
void setEstimatedLaunchTime(String packageName, long estimatedLaunchTime, int userId) throws RemoteException;
114+
115+
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
116+
void setEstimatedLaunchTimes(ParceledListSlice appLaunchTimes, int userId) throws RemoteException;
117+
90118
@RequiresApi(Build.VERSION_CODES.P)
91119
void registerAppUsageObserver(int observerId, String[] packages, long timeLimitMs, PendingIntent callback,
92120
String callingPackage) throws RemoteException;
@@ -120,9 +148,21 @@ void reportPastUsageStart(IBinder activity, String token, long timeAgoMs, String
120148
@RequiresApi(Build.VERSION_CODES.Q)
121149
void reportUsageStop(IBinder activity, String token, String callingPackage) throws RemoteException;
122150

151+
@RequiresApi(Build.VERSION_CODES.S)
152+
void reportUserInteraction(String packageName, int userId) throws RemoteException;
153+
154+
@RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE) // Android 14 r50
155+
void reportUserInteractionWithBundle(String packageName, int userId, PersistableBundle eventExtras) throws RemoteException;
156+
123157
@RequiresApi(Build.VERSION_CODES.Q)
124158
int getUsageSource() throws RemoteException;
125159

126160
@RequiresApi(Build.VERSION_CODES.Q)
127161
void forceUsageSourceSettingRead() throws RemoteException;
162+
163+
@RequiresApi(Build.VERSION_CODES.S)
164+
long getLastTimeAnyComponentUsed(String packageName, String callingPackage) throws RemoteException;
165+
166+
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
167+
String getAppStandbyConstant(String key) throws RemoteException;
128168
}

hiddenapi/src/main/java/android/content/IntentHidden.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
public class IntentHidden {
1919
@IntDef(flag = true, value = {
2020
EXTENDED_FLAG_FILTER_MISMATCH,
21+
EXTENDED_FLAG_MISSING_CREATOR_OR_INVALID_TOKEN,
22+
EXTENDED_FLAG_NESTED_INTENT_KEYS_COLLECTED,
2123
})
2224
@Retention(RetentionPolicy.SOURCE)
2325
public @interface ExtendedFlags {}
@@ -29,6 +31,18 @@ public class IntentHidden {
2931
@RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE) // Android 14 r50
3032
public static final int EXTENDED_FLAG_FILTER_MISMATCH = 1 << 0;
3133

34+
/**
35+
* This flag indicates the creator token of this intent is either missing or invalid.
36+
*/
37+
@RequiresApi(Build.VERSION_CODES.VANILLA_ICE_CREAM) // Android 15 r20
38+
public static final int EXTENDED_FLAG_MISSING_CREATOR_OR_INVALID_TOKEN = 1 << 1;
39+
40+
/**
41+
* This flag indicates this intent called {@code #collectExtraIntentKeys()}.
42+
*/
43+
@RequiresApi(Build.VERSION_CODES.VANILLA_ICE_CREAM) // Android 15 r20
44+
public static final int EXTENDED_FLAG_NESTED_INTENT_KEYS_COLLECTED = 1 << 2;
45+
3246

3347
/**
3448
* Retrieve any extended flags associated with this intent. You will

hiddenapi/src/main/java/android/content/om/IOverlayManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public interface IOverlayManager extends IInterface {
120120
*/
121121
boolean setLowestPriority(String packageName, int userId) throws RemoteException;
122122

123-
public static abstract class Stub {
123+
abstract class Stub {
124124
public static IOverlayManager asInterface(IBinder binder) {
125125
return HiddenUtil.throwUOE(binder);
126126
}

0 commit comments

Comments
 (0)