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