Open app when clicking on icon in App Info
Based on Xposed module Shortcut in App Info:
http://repo.xposed.info/module/com.mohammadag.shortcutinappinfo
Credit: Adam77Root
There is no vibration as in the module as I didn't find it necessary
Change-Id: I9c09a17bd0fd3a205ebb9cde366ce9d2335c6a84
[ jaysonedson@gmail.com: Ported to Pie/Android12 ]
Signed-off-by: Jason Edson <jaysonedson@gmail.com>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
diff --git a/src/com/android/settings/widget/EntityHeaderController.java b/src/com/android/settings/widget/EntityHeaderController.java
index c89b7bb..208be15 100644
--- a/src/com/android/settings/widget/EntityHeaderController.java
+++ b/src/com/android/settings/widget/EntityHeaderController.java
@@ -25,6 +25,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.os.UserHandle;
import android.text.TextUtils;
@@ -76,6 +77,7 @@
// Required for hearing aid devices.
private CharSequence mSecondSummary;
private String mPackageName;
+ private String mPackageNameReal;
private Intent mAppNotifPrefIntent;
@UserIdInt
private int mUid = UserHandle.USER_NULL;
@@ -134,6 +136,7 @@
*/
public EntityHeaderController setIcon(ApplicationsState.AppEntry appEntry) {
mIcon = Utils.getBadgedIcon(mAppContext, appEntry.info);
+ mPackageNameReal = appEntry.info.packageName;
return this;
}
@@ -233,6 +236,18 @@
if (iconView != null) {
iconView.setImageDrawable(mIcon);
iconView.setContentDescription(mIconContentDescription);
+ if (mPackageNameReal != null) {
+ iconView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ PackageManager pm = v.getContext().getPackageManager();
+ Intent intent = pm.getLaunchIntentForPackage(mPackageNameReal);
+ if (intent == null)
+ return;
+ v.getContext().startActivity(intent);
+ }
+ });
+ }
}
setText(R.id.entity_header_title, mLabel);
setText(R.id.entity_header_summary, mSummary);