| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.app; |
| 18 |
|
| 19 |
import android.compat.annotation.UnsupportedAppUsage; |
| 20 |
import android.content.pm.IPackageManager; |
| 21 |
import android.permission.IPermissionManager; |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
public class AppGlobals { |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
@UnsupportedAppUsage |
| 33 |
public static Application getInitialApplication() { |
| 34 |
return ActivityThread.currentApplication(); |
| 35 |
} |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
@UnsupportedAppUsage |
| 42 |
public static String getInitialPackage() { |
| 43 |
return ActivityThread.currentPackageName(); |
| 44 |
} |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
@UnsupportedAppUsage |
| 51 |
public static IPackageManager getPackageManager() { |
| 52 |
return ActivityThread.getPackageManager(); |
| 53 |
} |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
public static IPermissionManager getPermissionManager() { |
| 60 |
return ActivityThread.getPermissionManager(); |
| 61 |
} |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
public static int getIntCoreSetting(String key, int defaultValue) { |
| 71 |
ActivityThread currentActivityThread = ActivityThread.currentActivityThread(); |
| 72 |
if (currentActivityThread != null) { |
| 73 |
return currentActivityThread.getIntCoreSetting(key, defaultValue); |
| 74 |
} else { |
| 75 |
return defaultValue; |
| 76 |
} |
| 77 |
} |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
public static float getFloatCoreSetting(String key, float defaultValue) { |
| 87 |
ActivityThread currentActivityThread = ActivityThread.currentActivityThread(); |
| 88 |
if (currentActivityThread != null) { |
| 89 |
return currentActivityThread.getFloatCoreSetting(key, defaultValue); |
| 90 |
} else { |
| 91 |
return defaultValue; |
| 92 |
} |
| 93 |
} |
| 94 |
} |