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

Commit 7e49da30 authored by Ivan Chiang's avatar Ivan Chiang
Browse files

[PM] Do some refactor in PIA

Flag: android.content.pm.use_pia_v2
Test: m
Bug: 274120822
Change-Id: I8ab25bca3fb05b70d3205ddc455dad0e64ea4216
parent 61cd4d66
Loading
Loading
Loading
Loading
+38 −4
Original line number Diff line number Diff line
@@ -19,8 +19,8 @@
    <!-- TODO(b/274120822): Add product configs for required strings -->

    <!-- Dialog Titles -->
    <string name="title_unknown_source_blocked">Permission needed</string>
    <string name="title_anonymous_source_warning">Install from unknown source?</string>
    <string name="title_unknown_source_blocked">Install unknown apps</string>
    <string name="title_anonymous_source_warning">Install unknown app?</string>
    <string name="title_install_blocked">Install blocked</string>

    <string name="title_install_staging">Preparing to install app&#8230;</string>
@@ -70,8 +70,42 @@

    <!-- Dialog Messages -->
    <string name="message_update_owner_change">This app normally receives updates from &lt;b><xliff:g id="existing_update_owner">%1$s</xliff:g>&lt;/b>. By updating from a different source, you may receive future updates from any source on your tablet. App functionality may change.</string>
    <string name="message_external_source_blocked">To protect your phone and data, &lt;b><xliff:g id="installer_app_label">%1$s</xliff:g>&lt;/b> needs permission to install unknown apps. You can change this in Settings.</string>
    <string name="message_anonymous_source_warning"> Your phone and personal data are more vulnerable to attack by unknown apps. By installing this app, you agree that you are responsible for any damage to your phone or loss of data that may result from its use.</string>

    <!-- Text to show in warning dialog on the tablet when the app source is not trusted [CHAR LIMIT=NONE] -->
    <string name="message_external_source_blocked" product="tablet">For your security, your tablet currently isn’t allowed to install unknown apps from this source. You can change this in Settings.</string>

    <!-- Text to show in warning dialog on the tv when the app source is not trusted [CHAR LIMIT=NONE] -->
    <string name="message_external_source_blocked" product="tv">For your security, your TV currently isn’t allowed to install unknown apps from this source. You can change this in Settings.</string>

    <!-- Text to show in warning dialog on the wear when the app source is not trusted [CHAR LIMIT=NONE] -->
    <string name="message_external_source_blocked" product="watch">For your security, your watch currently isn’t allowed to install unknown apps from this source. You can change this in Settings.</string>

    <!-- Text to show in warning dialog on the phone when the app source is not trusted [CHAR LIMIT=NONE] -->
    <string name="message_external_source_blocked" product="default">For your security, your phone currently isn’t allowed to install unknown apps from this source. You can change this in Settings.</string>

    <!-- Text to show in warning dialog on the phone when the app source cannot be identified [CHAR LIMIT=NONE] -->
    <string name="message_anonymous_source_warning" product="default">
        Your phone and personal data are more vulnerable
        to attack by unknown apps. By installing this app, you
        agree that you are responsible for any damage to your
        phone or loss of data that may result from its use.
    </string>

    <!-- Text to show in warning dialog on the tablet when the app source cannot be identified [CHAR LIMIT=NONE] -->
    <string name="message_anonymous_source_warning" product="tablet">
        Your tablet and personal data are more vulnerable
        to attack by unknown apps. By installing this app, you
        agree that you are responsible for any damage to your
        tablet or loss of data that may result from its use.
    </string>

    <!-- Text to show in warning dialog on the tv when the app source cannot be identified [CHAR LIMIT=NONE] -->
    <string name="message_anonymous_source_warning" product="tv">
        Your TV and personal data are more vulnerable
        to attack by unknown apps. By installing this app, you
        agree that you are responsible for any damage to your
        TV or loss of data that may result from its use.
    </string>

    <string name="message_install_failed_blocked">This app was blocked from being installed</string>
    <string name="message_install_failed_conflict">This app conflicts with an app already on your device</string>
+7 −7
Original line number Diff line number Diff line
@@ -25,10 +25,9 @@ import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.text.Html;
import android.text.Spanned;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
@@ -90,12 +89,13 @@ public class ExternalSourcesBlockedFragment extends DialogFragment {

        View dialogView = getLayoutInflater().inflate(R.layout.install_fragment_layout, null);

        dialogView.requireViewById(R.id.app_snippet).setVisibility(View.VISIBLE);
        ((ImageView) dialogView.requireViewById(R.id.app_icon))
                .setImageDrawable(mDialogData.getAppIcon());
        ((TextView) dialogView.requireViewById(R.id.app_label)).setText(mDialogData.getAppLabel());

        TextView customMessage = dialogView.requireViewById(R.id.custom_message);
        String sourceBlockedString =
                getString(R.string.message_external_source_blocked, mDialogData.getAppLabel());
        Spanned styledSourceBlockedString =
                Html.fromHtml(sourceBlockedString, Html.FROM_HTML_MODE_LEGACY);
        customMessage.setText(styledSourceBlockedString);
        customMessage.setText(R.string.message_external_source_blocked);
        customMessage.setVisibility(View.VISIBLE);

        Log.i(LOG_TAG, "Creating " + LOG_TAG + "\n" + mDialogData);