Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b4f8ed9b authored by eunjeongshin's avatar eunjeongshin
Browse files

User consent for Logcat data access

The LogcatManagerService checks if logd access is coming
from background or foreground.

If the requester is foreground, the LogcatManagerService
generates a notification to get user consent. If the user grants access,
the LogcatManagerService approves logd access. If the user
does not grant access, the LogcatManagerService denies logd access.

If the requester is background, the LogcatManagerService waits
to observe process status change. If the
process status updates to foreground from background,
LogcatManagerService sends a notification to get user consent.
If the process remains background, the LogcatManagerService denies logd access.

This codebase is the continuity of the implementation ag/16618162 to
obtain user consent.

Bug: 193708292
Test: CtsVerifier
Ignore-AOSP-First: pending fix for logcat privacy issue

Change-Id: I4103c72daebdea5e8f04ab4901c05be2f1aefc84
parent 8a0a4e6d
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -214,6 +214,14 @@ public abstract class ActivityManagerInternal {
     */
    public abstract boolean isSystemReady();

    /**
     * Returns package name given pid.
     *
     * @param pid The pid we are searching package name for.
     */
    @Nullable
    public abstract String getPackageNameByPid(int pid);

    /**
     * Sets if the given pid has an overlay UI or not.
     *
+2 −0
Original line number Diff line number Diff line
@@ -22,5 +22,7 @@ package android.os.logcat;
interface ILogcatManagerService {
    void startThread(in int uid, in int gid, in int pid, in int fd);
    void finishThread(in int uid, in int gid, in int pid, in int fd);
    void approve(in int uid, in int gid, in int pid, in int fd);
    void decline(in int uid, in int gid, in int pid, in int fd);
}
+8 −0
Original line number Diff line number Diff line
@@ -6542,6 +6542,14 @@
                  android:exported="false">
        </activity>

        <activity android:name="com.android.server.logcat.LogAccessConfirmationActivity"
                  android:theme="@style/Theme.Dialog.Confirmation"
                  android:excludeFromRecents="true"
                  android:process=":ui"
                  android:label="@string/log_access_confirmation_title"
                  android:exported="false">
        </activity>

        <activity android:name="com.android.server.notification.NASLearnMoreActivity"
                  android:theme="@style/Theme.Dialog.Confirmation"
                  android:excludeFromRecents="true"
+14 −0
Original line number Diff line number Diff line
@@ -5714,6 +5714,20 @@
    <!-- Title for the harmful app warning dialog. [CHAR LIMIT=40] -->
    <string name="harmful_app_warning_title">Harmful app detected</string>

    <!-- Title for the log access confirmation dialog. [CHAR LIMIT=40] -->
    <string name="log_access_confirmation_title">System log access request</string>
    <!-- Label for the allow button on the log access confirmation dialog. [CHAR LIMIT=20] -->
    <string name="log_access_confirmation_allow">Only this time</string>
    <!-- Label for the deny button on the log access confirmation dialog. [CHAR LIMIT=20] -->
    <string name="log_access_confirmation_deny">Don\u2019t allow</string>

    <!-- Content for the log access confirmation dialog. [CHAR LIMIT=NONE]-->
    <string name="log_access_confirmation_body"><xliff:g id="log_access_app_name" example="Example App">%s</xliff:g> requests system logs for functional debugging.
        These logs might contain information that apps and services on your device have written.</string>

    <!-- Privacy notice do not show [CHAR LIMIT=20] -->
    <string name="log_access_do_not_show_again">Don\u2019t show again</string>

    <!-- Text describing a permission request for one app to show another app's
         slices [CHAR LIMIT=NONE] -->
    <string name="slices_permission_request"><xliff:g id="app" example="Example App">%1$s</xliff:g> wants to show <xliff:g id="app_2" example="Other Example App">%2$s</xliff:g> slices</string>
+5 −0
Original line number Diff line number Diff line
@@ -3846,6 +3846,11 @@
  <java-symbol type="string" name="harmful_app_warning_title" />
  <java-symbol type="layout" name="harmful_app_warning_dialog" />

  <java-symbol type="string" name="log_access_confirmation_allow" />
  <java-symbol type="string" name="log_access_confirmation_deny" />
  <java-symbol type="string" name="log_access_confirmation_title" />
  <java-symbol type="string" name="log_access_confirmation_body" />

  <java-symbol type="string" name="config_defaultAssistantAccessComponent" />

  <java-symbol type="string" name="slices_permission_request" />
Loading