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

Commit b5551f47 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Make links in appwarnings clickable" into main

parents 79789c7d 4c88318d
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ import android.util.Pair;
import android.util.Slog;
import android.util.SparseArray;
import android.util.Xml;
import android.view.ContextThemeWrapper;

import com.android.internal.annotations.GuardedBy;
import com.android.internal.util.ArrayUtils;
@@ -498,10 +499,21 @@ class AppWarnings {
            }
        }
        if (!hasPackageFlag(userId, ar.packageName, FLAG_HIDE_PAGE_SIZE_MISMATCH)) {
            Context context =  getUiContextForActivity(ar);
            // PageSizeMismatchDialog has link in message which should open in browser.
            // Starting activity from non-activity context is not allowed and flag
            // FLAG_ACTIVITY_NEW_TASK is needed to start activity.
            context =  new ContextThemeWrapper(context, context.getThemeResId()) {
                @Override
                public void startActivity(Intent intent) {
                    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    super.startActivity(intent);
                }
            };
            pageSizeMismatchDialog =
                    new PageSizeMismatchDialog(
                            AppWarnings.this,
                            getUiContextForActivity(ar),
                            context,
                            ar.info.applicationInfo,
                            userId,
                            warning);
+11 −1
Original line number Diff line number Diff line
@@ -24,8 +24,10 @@ import android.content.pm.ApplicationInfo;
import android.content.pm.PackageItemInfo;
import android.content.pm.PackageManager;
import android.text.Html;
import android.text.method.LinkMovementMethod;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

import com.android.internal.R;

@@ -69,6 +71,14 @@ class PageSizeMismatchDialog extends AppWarnings.BaseDialog {
        mDialog.create();

        final Window window = mDialog.getWindow();
        window.setType(WindowManager.LayoutParams.TYPE_PHONE);
        window.setType(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY);
    }

    @Override
    public void show() {
        super.show();
        // Make the links in dialog clickable
        final TextView msgTxt = (TextView) mDialog.findViewById(android.R.id.message);
        msgTxt.setMovementMethod(LinkMovementMethod.getInstance());
    }
}