From c389f11521a882cb069dfb15e67dc2f70aa082b1 Mon Sep 17 00:00:00 2001 From: deadman96385 Date: Wed, 21 Oct 2015 00:51:42 +0300 Subject: [PATCH] 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 @mydongistiny: Ported to Pie Change-Id: I9c09a17bd0fd3a205ebb9cde366ce9d2335c6a84 Signed-off-by: mydongistiny Signed-off-by: blinoff82 Signed-off-by: SagarMakhar Signed-off-by: Pranav Vashi --- .../settings/widget/EntityHeaderController.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/com/android/settings/widget/EntityHeaderController.java b/src/com/android/settings/widget/EntityHeaderController.java index c89b7bb4cd9..208be158c04 100644 --- a/src/com/android/settings/widget/EntityHeaderController.java +++ b/src/com/android/settings/widget/EntityHeaderController.java @@ -25,6 +25,7 @@ import android.app.settings.SettingsEnums; 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 @@ public class EntityHeaderController { // 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 class EntityHeaderController { */ public EntityHeaderController setIcon(ApplicationsState.AppEntry appEntry) { mIcon = Utils.getBadgedIcon(mAppContext, appEntry.info); + mPackageNameReal = appEntry.info.packageName; return this; } @@ -233,6 +236,18 @@ public class EntityHeaderController { 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);