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

Commit b399db7b authored by android-build-team Robot's avatar android-build-team Robot Committed by Android (Google) Code Review
Browse files

Merge "Don't be clever with strings" into pi-dev

parents 8aeb74ac 15db7cdf
Loading
Loading
Loading
Loading
+14 −15
Original line number Original line Diff line number Diff line
@@ -1567,21 +1567,20 @@
    <!-- Notification: Control panel: Label that displays when the app's notifications cannot be blocked. -->
    <!-- Notification: Control panel: Label that displays when the app's notifications cannot be blocked. -->
    <string name="notification_unblockable_desc">These notifications can\'t be turned off</string>
    <string name="notification_unblockable_desc">These notifications can\'t be turned off</string>


    <string name="notification_appops_camera_active">camera</string>
    <!-- Notification Inline controls: describes what the app is doing in the background [CHAR_LIMIT=NONE] -->

    <string name="appops_camera">This app is using the camera.</string>
    <string name="notification_appops_microphone_active">microphone</string>
    <!-- Notification Inline controls: describes what the app is doing in the background [CHAR_LIMIT=NONE] -->

    <string name="appops_microphone">This app is using the microphone.</string>
    <string name="notification_appops_overlay_active">displaying over other apps on your screen</string>
    <!-- Notification Inline controls: describes what the app is doing in the background [CHAR_LIMIT=NONE] -->

    <string name="appops_overlay">This app is displaying over other apps on your screen.</string>
    <plurals name="notification_appops">
    <!-- Notification Inline controls: describes what the app is doing in the background [CHAR_LIMIT=NONE] -->
        <item quantity="one">This app is <xliff:g id="performing activity" example="using the camera">%1$s</xliff:g>.</item>
    <string name="appops_camera_mic">This app is using the microphone and camera.</string>
        <item quantity="other">This app is <xliff:g id="performing activity" example="using the camera">%1$s</xliff:g> and <xliff:g id="performing activity" example="using the microphone">%2$s</xliff:g>.</item>
    <!-- Notification Inline controls: describes what the app is doing in the background [CHAR_LIMIT=NONE] -->
    </plurals>
    <string name="appops_camera_overlay">This app is displaying over other apps on your screen and using the camera.</string>

    <!-- Notification Inline controls: describes what the app is doing in the background [CHAR_LIMIT=NONE] -->
    <plurals name="notification_using">
    <string name="appops_mic_overlay">This app is displaying over other apps on your screen and using the microphone.</string>
        <item quantity="one">using the <xliff:g id="performing activity" example="camera">%1$s</xliff:g></item>
    <!-- Notification Inline controls: describes what the app is doing in the background [CHAR_LIMIT=NONE] -->
        <item quantity="other">using the <xliff:g id="performing activity" example="camera">%1$s</xliff:g> and <xliff:g id="performing activity" example="microphone">%2$s</xliff:g></item>
    <string name="appops_camera_mic_overlay">This app is displaying over other apps on your screen and using the microphone and camera.</string>
    </plurals>


    <string name="notification_appops_settings">Settings</string>
    <string name="notification_appops_settings">Settings</string>
    <string name="notification_appops_ok">OK</string>
    <string name="notification_appops_ok">OK</string>
+21 −32
Original line number Original line Diff line number Diff line
@@ -109,7 +109,7 @@ public class AppOpsInfo extends LinearLayout implements NotificationGuts.GutsCon


    private void bindPrompt() {
    private void bindPrompt() {
        final TextView prompt = findViewById(R.id.prompt);
        final TextView prompt = findViewById(R.id.prompt);
        prompt.setText(getPromptString());
        prompt.setText(getPrompt());
    }
    }


    private void bindButtons() {
    private void bindButtons() {
@@ -121,41 +121,30 @@ public class AppOpsInfo extends LinearLayout implements NotificationGuts.GutsCon
        ok.setOnClickListener(mOnOk);
        ok.setOnClickListener(mOnOk);
    }
    }


    private String getPromptString() {
    private String getPrompt() {
        String cameraString =
        if (mAppOps == null || mAppOps.size() == 0) {
                mContext.getResources().getString(R.string.notification_appops_camera_active);
            return "";
        String micString =
        } else if (mAppOps.size() == 1) {
                mContext.getResources().getString(R.string.notification_appops_microphone_active);
            if (mAppOps.contains(AppOpsManager.OP_CAMERA)) {
        String overlayString =
                return mContext.getString(R.string.appops_camera);
                mContext.getResources().getString(R.string.notification_appops_overlay_active);
        String using = null;
        String promptString;
        if (mAppOps.contains(AppOpsManager.OP_CAMERA)
                && mAppOps.contains(AppOpsManager.OP_RECORD_AUDIO)) {
            using = mContext.getResources().getQuantityString(
                    R.plurals.notification_using, 2, micString, cameraString);
        } else if (mAppOps.contains(AppOpsManager.OP_CAMERA)) {
            using = mContext.getResources().getQuantityString(
                    R.plurals.notification_using, 1, cameraString);
            } else if (mAppOps.contains(AppOpsManager.OP_RECORD_AUDIO)) {
            } else if (mAppOps.contains(AppOpsManager.OP_RECORD_AUDIO)) {
            using = mContext.getResources().getQuantityString(
                return mContext.getString(R.string.appops_microphone);
                    R.plurals.notification_using, 1, micString);
            } else {
                return mContext.getString(R.string.appops_overlay);
            }
            }

        } else if (mAppOps.size() == 2) {
        if (mAppOps.contains(AppOpsManager.OP_SYSTEM_ALERT_WINDOW)) {
            if (mAppOps.contains(AppOpsManager.OP_CAMERA)) {
            if (using != null) {
                if (mAppOps.contains(AppOpsManager.OP_RECORD_AUDIO)) {
                promptString = mContext.getResources().getQuantityString(
                    return mContext.getString(R.string.appops_camera_mic);
                        R.plurals.notification_appops, 2, overlayString, using);
                } else {
                } else {
                promptString = mContext.getResources().getQuantityString(
                    return mContext.getString(R.string.appops_camera_overlay);
                        R.plurals.notification_appops, 1, overlayString);
                }
                }
            } else {
            } else {
            promptString = mContext.getResources().getQuantityString(
                return mContext.getString(R.string.appops_mic_overlay);
                    R.plurals.notification_appops, 1, using);
            }
        } else {
            return mContext.getString(R.string.appops_camera_mic_overlay);
        }
        }

        return promptString;
    }
    }


    @Override
    @Override