Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
dependencies ▾

Modern-Apps.git / logviewer / src / main / AndroidManifest.xml

AndroidManifest.xml127 lines · 7.4 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 <!-- MAOS: opt out of the GrapheneOS Sensors permission (OTHER_SENSORS). -->
16 <!-- This app uses no motion/environment sensors; MAOS withholds the -->
17 <!-- Sensors permission at install instead of auto-granting it. -->
18 <uses-permission android:name="com.vayunmathur.permission.SENSORS_OPTOUT" />
19
20 <uses-permission android:name="android.permission.READ_LOGS" />
21 <!-- tools:ignore because lint's SystemPermissionTypo check thinks this is a misspelling of
22 READ_LOGS and offers to "correct" it. It is not: READ_LOGS_FULL is a real GrapheneOS
23 permission that grants the unredacted log, and taking lint's suggestion would silently
24 downgrade what every report contains. -->
25 <uses-permission
26 android:name="android.permission.READ_LOGS_FULL"
27 tools:ignore="SystemPermissionTypo" />
28 <uses-permission
29 android:name="android.permission.READ_OEM_UNLOCK_STATE"
30 tools:ignore="ProtectedPermissions" />
31 <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
32 <!-- A log can be about ANY installed app, and both the uid to filter logcat on and the label in
33 the title come from PackageManager. A <queries> list is not an option when the set of
34 packages is "whichever one just crashed". -->
35 <uses-permission
36 android:name="android.permission.QUERY_ALL_PACKAGES"
37 tools:ignore="QueryAllPackagesPermission" />
38 <uses-permission
39 android:name="android.permission.QUERY_USERS"
40 tools:ignore="ProtectedPermissions" />
41
42 <!-- Renamed from app.grapheneos.logviewer.* but the protection levels are unchanged, because
43 they are what makes the two entry points safe to export. `privileged` on the logcat side
44 means only a priv-app can read the system log; `preinstalled` on the error-report side is
45 looser on purpose, so a preinstalled app can show the user its own crash. -->
46 <permission
47 android:name="com.vayunmathur.logviewer.SHOW_LOGCAT"
48 android:label="@string/permission_show_logcat_label"
49 android:description="@string/permission_show_logcat_desc"
50 android:protectionLevel="signature|privileged" />
51
52 <permission
53 android:name="com.vayunmathur.logviewer.SHOW_ERROR_REPORT"
54 android:label="@string/permission_show_error_report_label"
55 android:description="@string/permission_show_error_report_desc"
56 android:protectionLevel="signature|preinstalled" />
57
58 <!-- usesNonSdkApi is what makes platform/HiddenFrameworkApi.kt actually work, and without it
59 that file is dead code. ApplicationInfo.isAllowedToUseHiddenApis() (framework source,
60 ApplicationInfo.java:2646-2654) reads:
61 if (isSignedWithPlatformKey()) return true;
62 else if (isSystemApp() || isUpdatedSystemApp())
63 return usesNonSdkApi() || whitelisted;
64 else return false;
65 We are a system app in /product/priv-app but signed with the Modern Apps release key, not
66 the platform key - so the first branch is false and the second decides it. Without this
67 attribute the policy is HIDDEN_API_ENFORCEMENT_ENABLED and every reflective lookup returns
68 null forever, silently dropping the userType, package version and processUptime header
69 fields that the app we replace prints.
70
71 The alternative was a <hidden-api-whitelisted-app> entry in sysconfig-modern-apps.xml.
72 This is the narrower of the two: it is self-declared in the app's own reviewable manifest,
73 and it is inert for a non-system install (the branch above is only reached for a system
74 app), where the reflection simply keeps degrading to omitted lines. -->
75 <application
76 android:allowBackup="false"
77 android:dataExtractionRules="@xml/data_extraction_rules"
78 android:icon="@mipmap/ic_launcher"
79 android:label="@string/app_name"
80 android:roundIcon="@mipmap/ic_launcher"
81 android:supportsRtl="true"
82 android:theme="@style/Theme.General"
83 android:usesNonSdkApi="true">
84
85 <!-- Deliberately no MAIN/LAUNCHER activity. Both entry points are permission-guarded and
86 reached from elsewhere - Settings, the system's crash dialog, or another priv-app - so
87 a launcher entry would only offer an icon that cannot do anything on its own. -->
88 <activity
89 android:name=".intents.LogcatActivity"
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_LOGCAT"
94 android:theme="@style/Theme.General">
95 <intent-filter>
96 <action android:name="${applicationId}.LOGCAT" />
97 <action android:name="${applicationId}.PKG_LOGCAT" />
98 <category android:name="android.intent.category.DEFAULT" />
99 </intent-filter>
100 </activity>
101
102 <activity
103 android:name=".intents.ErrorReportActivity"
104 android:configChanges="mcc|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|keyboardHidden|layoutDirection|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode"
105 android:documentLaunchMode="always"
106 android:exported="true"
107 android:permission="com.vayunmathur.logviewer.SHOW_ERROR_REPORT"
108 android:theme="@style/Theme.General">
109 <intent-filter>
110 <action android:name="${applicationId}.ERROR_REPORT" />
111 <action android:name="android.intent.action.APP_ERROR" />
112 <category android:name="android.intent.category.DEFAULT" />
113 </intent-filter>
114 </activity>
115
116 <!-- Serves a log snapshot to the share target as a content: Uri without ever writing it to
117 storage. A file would have to be cleaned up and would briefly put the log somewhere
118 another app could read; putting the bytes in the Intent instead would blow the binder
119 transaction limit on any real log. -->
120 <provider
121 android:name=".provider.BlobProvider"
122 android:authorities="${applicationId}.BlobProvider"
123 android:exported="false"
124 android:grantUriPermissions="true" />
125
126 </application>
127</manifest>