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

Commit 4c88318d authored by Pawan Wagh's avatar Pawan Wagh
Browse files

Make links in appwarnings clickable

Flag: android.content.pm.app_compat_option_16kb
Test: atest -c FileSystemUtilsTests
Test: Install 4KB aligned app and see the dialog on
16 KB device and click link
Bug: 389796812

Change-Id: I6b42975cbddb11a521296facf5b6e22785db23a9
parent 5c53d8fd
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());
    }
}