Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / logviewer / src / main / AndroidManifest.xml
AndroidManifest.xml113 lines · 6.8 KiBRaw
| 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | <manifest xmlns:android="http://schemas.android.com/apk/res/android" |
| 3 | xmlns:tools="http://schemas.android.com/tools"> |
| 4 | |
| 5 | <!-- All five are kept from the app this replaces, and all five are load-bearing because we |
| 6 | ship preinstalled in /system/priv-app rather than sideloaded. READ_LOGS_FULL, |
| 7 | READ_OEM_UNLOCK_STATE and QUERY_USERS are signature|privileged, so each also needs an |
| 8 | entry in vendor/modern-apps/privapp-permissions-modern-apps.xml - a missing entry there |
| 9 | is a boot failure under ro.control_privapp_permissions=enforce, and a spurious one is |
| 10 | equally fatal. |
| 11 | |
| 12 | READ_OEM_UNLOCK_STATE backs the "bootloader unlocked" flag and QUERY_USERS backs the |
| 13 | "userType:" line in every report header; dropping either would silently change the output |
| 14 | of the app we are replacing. --> |
| 15 | <uses-permission android:name="android.permission.READ_LOGS" /> |
| 16 | <!-- tools:ignore because lint's SystemPermissionTypo check thinks this is a misspelling of |
| 17 | READ_LOGS and offers to "correct" it. It is not: READ_LOGS_FULL is a real GrapheneOS |
| 18 | permission that grants the unredacted log, and taking lint's suggestion would silently |
| 19 | downgrade what every report contains. --> |
| 20 | <uses-permission |
| 21 | android:name="android.permission.READ_LOGS_FULL" |
| 22 | tools:ignore="SystemPermissionTypo" /> |
| 23 | <uses-permission android:name="android.permission.READ_OEM_UNLOCK_STATE" /> |
| 24 | <!-- A log can be about ANY installed app, and both the uid to filter logcat on and the label in |
| 25 | the title come from PackageManager. A <queries> list is not an option when the set of |
| 26 | packages is "whichever one just crashed". --> |
| 27 | <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" /> |
| 28 | <uses-permission android:name="android.permission.QUERY_USERS" /> |
| 29 | |
| 30 | <!-- Renamed from app.grapheneos.logviewer.* but the protection levels are unchanged, because |
| 31 | they are what makes the two entry points safe to export. `privileged` on the logcat side |
| 32 | means only a priv-app can read the system log; `preinstalled` on the error-report side is |
| 33 | looser on purpose, so a preinstalled app can show the user its own crash. --> |
| 34 | <permission |
| 35 | android:name="com.vayunmathur.logviewer.SHOW_LOGCAT" |
| 36 | android:label="@string/permission_show_logcat_label" |
| 37 | android:description="@string/permission_show_logcat_desc" |
| 38 | android:protectionLevel="signature|privileged" /> |
| 39 | |
| 40 | <permission |
| 41 | android:name="com.vayunmathur.logviewer.SHOW_ERROR_REPORT" |
| 42 | android:label="@string/permission_show_error_report_label" |
| 43 | android:description="@string/permission_show_error_report_desc" |
| 44 | android:protectionLevel="signature|preinstalled" /> |
| 45 | |
| 46 | <!-- usesNonSdkApi is what makes platform/HiddenFrameworkApi.kt actually work, and without it |
| 47 | that file is dead code. ApplicationInfo.isAllowedToUseHiddenApis() (framework source, |
| 48 | ApplicationInfo.java:2646-2654) reads: |
| 49 | if (isSignedWithPlatformKey()) return true; |
| 50 | else if (isSystemApp() || isUpdatedSystemApp()) |
| 51 | return usesNonSdkApi() || whitelisted; |
| 52 | else return false; |
| 53 | We are a system app in /product/priv-app but signed with the Modern Apps release key, not |
| 54 | the platform key - so the first branch is false and the second decides it. Without this |
| 55 | attribute the policy is HIDDEN_API_ENFORCEMENT_ENABLED and every reflective lookup returns |
| 56 | null forever, silently dropping the userType, package version and processUptime header |
| 57 | fields that the app we replace prints. |
| 58 | |
| 59 | The alternative was a <hidden-api-whitelisted-app> entry in sysconfig-modern-apps.xml. |
| 60 | This is the narrower of the two: it is self-declared in the app's own reviewable manifest, |
| 61 | and it is inert for a non-system install (the branch above is only reached for a system |
| 62 | app), where the reflection simply keeps degrading to omitted lines. --> |
| 63 | <application |
| 64 | android:icon="@mipmap/ic_launcher" |
| 65 | android:label="@string/app_name" |
| 66 | android:roundIcon="@mipmap/ic_launcher" |
| 67 | android:supportsRtl="true" |
| 68 | android:theme="@style/Theme.General" |
| 69 | android:usesNonSdkApi="true"> |
| 70 | |
| 71 | <!-- Deliberately no MAIN/LAUNCHER activity. Both entry points are permission-guarded and |
| 72 | reached from elsewhere - Settings, the system's crash dialog, or another priv-app - so |
| 73 | a launcher entry would only offer an icon that cannot do anything on its own. --> |
| 74 | <activity |
| 75 | android:name=".intents.LogcatActivity" |
| 76 | android:configChanges="mcc|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|keyboardHidden|layoutDirection|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" |
| 77 | android:documentLaunchMode="always" |
| 78 | android:exported="true" |
| 79 | android:permission="com.vayunmathur.logviewer.SHOW_LOGCAT" |
| 80 | android:theme="@style/Theme.General"> |
| 81 | <intent-filter> |
| 82 | <action android:name="${applicationId}.LOGCAT" /> |
| 83 | <action android:name="${applicationId}.PKG_LOGCAT" /> |
| 84 | <category android:name="android.intent.category.DEFAULT" /> |
| 85 | </intent-filter> |
| 86 | </activity> |
| 87 | |
| 88 | <activity |
| 89 | android:name=".intents.ErrorReportActivity" |
| 90 | android:configChanges="mcc|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|keyboardHidden|layoutDirection|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" |
| 91 | android:documentLaunchMode="always" |
| 92 | android:exported="true" |
| 93 | android:permission="com.vayunmathur.logviewer.SHOW_ERROR_REPORT" |
| 94 | android:theme="@style/Theme.General"> |
| 95 | <intent-filter> |
| 96 | <action android:name="${applicationId}.ERROR_REPORT" /> |
| 97 | <action android:name="android.intent.action.APP_ERROR" /> |
| 98 | <category android:name="android.intent.category.DEFAULT" /> |
| 99 | </intent-filter> |
| 100 | </activity> |
| 101 | |
| 102 | <!-- Serves a log snapshot to the share target as a content: Uri without ever writing it to |
| 103 | storage. A file would have to be cleaned up and would briefly put the log somewhere |
| 104 | another app could read; putting the bytes in the Intent instead would blow the binder |
| 105 | transaction limit on any real log. --> |
| 106 | <provider |
| 107 | android:name=".provider.BlobProvider" |
| 108 | android:authorities="${applicationId}.BlobProvider" |
| 109 | android:exported="false" |
| 110 | android:grantUriPermissions="true" /> |
| 111 | |
| 112 | </application> |
| 113 | </manifest> |