Hide default webview app icon in developer options
Change-Id: I165d0a079f247a7162b0b94f9c52a343563aa527 Fixes: 65267538 Test: robotests
This commit is contained in:
@@ -18,7 +18,6 @@ package com.android.settings.development;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
@@ -64,11 +63,9 @@ public class WebViewAppPreferenceControllerV2 extends DeveloperOptionsPreference
|
||||
final CharSequence defaultAppLabel = getDefaultAppLabel();
|
||||
if (!TextUtils.isEmpty(defaultAppLabel)) {
|
||||
mPreference.setSummary(defaultAppLabel);
|
||||
mPreference.setIcon(getDefaultAppIcon());
|
||||
} else {
|
||||
Log.d(TAG, "No default app");
|
||||
mPreference.setSummary(R.string.app_list_preference_none);
|
||||
mPreference.setIcon(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,11 +86,6 @@ public class WebViewAppPreferenceControllerV2 extends DeveloperOptionsPreference
|
||||
currentPackage == null ? null : currentPackage.applicationInfo);
|
||||
}
|
||||
|
||||
private Drawable getDefaultAppIcon() {
|
||||
final DefaultAppInfo app = getDefaultAppInfo();
|
||||
return app.loadIcon();
|
||||
}
|
||||
|
||||
private CharSequence getDefaultAppLabel() {
|
||||
final DefaultAppInfo app = getDefaultAppInfo();
|
||||
return app.loadLabel();
|
||||
|
@@ -22,7 +22,6 @@ import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
|
||||
@@ -56,8 +55,6 @@ public class WebViewAppPreferenceControllerV2Test {
|
||||
private Preference mPreference;
|
||||
@Mock
|
||||
private DefaultAppInfo mAppInfo;
|
||||
@Mock
|
||||
private Drawable mDrawable;
|
||||
|
||||
private Context mContext;
|
||||
private WebViewAppPreferenceControllerV2 mController;
|
||||
@@ -80,24 +77,20 @@ public class WebViewAppPreferenceControllerV2Test {
|
||||
public void updateState_hasAppLabel_shouldSetAppLabelAndIcon() {
|
||||
final String appLabel = "SomeRandomAppLabel!!!";
|
||||
when(mAppInfo.loadLabel()).thenReturn(appLabel);
|
||||
when(mAppInfo.loadIcon()).thenReturn(mDrawable);
|
||||
|
||||
mController.updateState(mPreference);
|
||||
|
||||
verify(mPreference).setSummary(appLabel);
|
||||
verify(mPreference).setIcon(mDrawable);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_noAppLabel_shouldSetAppDefaultLabelAndNullIcon() {
|
||||
final String appLabel = null;
|
||||
when(mAppInfo.loadLabel()).thenReturn(appLabel);
|
||||
when(mAppInfo.loadIcon()).thenReturn(mDrawable);
|
||||
|
||||
mController.updateState(mPreference);
|
||||
|
||||
verify(mPreference).setSummary(R.string.app_list_preference_none);
|
||||
verify(mPreference).setIcon(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user