Remove deep link to app store from app header.
The link doesn't actually work and uses wrong icon. There is a working version at the app info screen already. Change-Id: I16890bd66e095c3185e12d604d8daba5036ab24c Fix: 37544209 Test: robotests
This commit is contained in:
@@ -52,15 +52,13 @@ public class AppHeaderController {
|
||||
@IntDef({ActionType.ACTION_NONE,
|
||||
ActionType.ACTION_APP_INFO,
|
||||
ActionType.ACTION_APP_PREFERENCE,
|
||||
ActionType.ACTION_STORE_DEEP_LINK,
|
||||
ActionType.ACTION_NOTIF_PREFERENCE})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface ActionType {
|
||||
int ACTION_NONE = 0;
|
||||
int ACTION_APP_INFO = 1;
|
||||
int ACTION_STORE_DEEP_LINK = 2;
|
||||
int ACTION_APP_PREFERENCE = 3;
|
||||
int ACTION_NOTIF_PREFERENCE = 4;
|
||||
int ACTION_APP_PREFERENCE = 2;
|
||||
int ACTION_NOTIF_PREFERENCE = 3;
|
||||
}
|
||||
|
||||
public static final String PREF_KEY_APP_HEADER = "pref_app_header";
|
||||
@@ -254,20 +252,6 @@ public class AppHeaderController {
|
||||
}
|
||||
return;
|
||||
}
|
||||
case ActionType.ACTION_STORE_DEEP_LINK: {
|
||||
final Intent intent = new Intent(Intent.ACTION_SHOW_APP_INFO)
|
||||
.setPackage(getInstallerPackageName(mContext, mPackageName));
|
||||
final Intent result = resolveIntent(intent);
|
||||
if (result == null) {
|
||||
button.setVisibility(View.GONE);
|
||||
} else {
|
||||
result.putExtra(Intent.EXTRA_PACKAGE_NAME, mPackageName);
|
||||
button.setImageResource(R.drawable.ic_sim_sd);
|
||||
button.setOnClickListener(v -> mFragment.startActivity(intent));
|
||||
button.setVisibility(View.VISIBLE);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case ActionType.ACTION_NOTIF_PREFERENCE: {
|
||||
if (mAppNotifPrefIntent == null) {
|
||||
button.setVisibility(View.GONE);
|
||||
@@ -295,15 +279,6 @@ public class AppHeaderController {
|
||||
}
|
||||
}
|
||||
|
||||
private String getInstallerPackageName(Context context, String packageName) {
|
||||
try {
|
||||
return context.getPackageManager().getInstallerPackageName(packageName);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.e(TAG, "Exception while retrieving the package installer of " + packageName, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private Intent resolveIntent(Intent i) {
|
||||
ResolveInfo result = mContext.getPackageManager().resolveActivity(i, 0);
|
||||
if (result != null) {
|
||||
|
@@ -415,8 +415,8 @@ public class InstalledAppDetails extends AppInfoBase
|
||||
.getApplicationFeatureProvider(activity)
|
||||
.newAppHeaderController(this, mHeader.findViewById(R.id.app_snippet))
|
||||
.setPackageName(mPackageName)
|
||||
.setButtonActions(AppHeaderController.ActionType.ACTION_STORE_DEEP_LINK,
|
||||
AppHeaderController.ActionType.ACTION_APP_PREFERENCE)
|
||||
.setButtonActions(AppHeaderController.ActionType.ACTION_APP_PREFERENCE,
|
||||
AppHeaderController.ActionType.ACTION_NONE)
|
||||
.styleActionBar(activity)
|
||||
.bindAppHeaderButtons();
|
||||
prepareUninstallAndStop();
|
||||
|
@@ -18,7 +18,6 @@ package com.android.settings.applications;
|
||||
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anyInt;
|
||||
import static org.mockito.Matchers.eq;
|
||||
@@ -171,25 +170,6 @@ public class AppHeaderControllerTest {
|
||||
.isEqualTo(View.GONE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindButton_noStoreLink_shouldNotShowButton() {
|
||||
final View appLinks = mLayoutInflater
|
||||
.inflate(R.layout.app_details, null /* root */);
|
||||
when(mContext.getPackageManager().resolveActivity(any(Intent.class), anyInt()))
|
||||
.thenReturn(null);
|
||||
|
||||
mController = new AppHeaderController(mContext, mFragment, appLinks);
|
||||
mController.setButtonActions(
|
||||
AppHeaderController.ActionType.ACTION_STORE_DEEP_LINK,
|
||||
AppHeaderController.ActionType.ACTION_NONE);
|
||||
mController.done(mActivity);
|
||||
|
||||
assertThat(appLinks.findViewById(R.id.left_button).getVisibility())
|
||||
.isEqualTo(View.GONE);
|
||||
assertThat(appLinks.findViewById(R.id.right_button).getVisibility())
|
||||
.isEqualTo(View.GONE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bindButton_noAppInfo_shouldNotShowButton() {
|
||||
final View appLinks = mLayoutInflater
|
||||
|
Reference in New Issue
Block a user