Update WebView implementation Dev Setting - new looks + descriptions.
Now that we are changing the WebView package mechanism so that a package can only be used as WebView implementation if that package is enabled for all users of the device we need to tell the user why a package can't be chosen as WebView implementation. With this CL we do so in the 'Set WebView Implementation' Developer Setting. We code for the WebView implementation Developer Setting is now based on the same code as that of the Debug App Developer Setting. Bug: 32894154 Test: Ensure WebView Implementation setting shows correct packages. Test: Ensure WebView Implementation setting shows correct descriptions for why a package is not usable - including the case where packages are disabled/uninstalled for a second user. Test: Ensure the summary for the WebView Implmentation setting is updated after changing WebView package. Test: Ensure the WebView package Activity (Settings.ACTION_WEBVIEW_SETTINGS) is similar to the Dev Setting. Test: ensure non-admin user cannot start WV-picker activity through 'adb shell am start -n com.android.settings/.WebViewImplementation' Change-Id: Ia6e6e9e12ce8f8f45ec539807cd0c6479acb8ecb
This commit is contained in:
33
src/com/android/settings/webview/UserPackageWrapper.java
Normal file
33
src/com/android/settings/webview/UserPackageWrapper.java
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.webview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.webkit.UserPackage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Wrapper class around android.webkit.UserPackage - to be able to use UserPackage in Robolectric
|
||||
* tests (such tests currently don't support mocking hidden classes).
|
||||
*/
|
||||
interface UserPackageWrapper {
|
||||
UserInfo getUserInfo();
|
||||
PackageInfo getPackageInfo();
|
||||
boolean isEnabledPackage();
|
||||
boolean isInstalledPackage();
|
||||
}
|
50
src/com/android/settings/webview/UserPackageWrapperImpl.java
Normal file
50
src/com/android/settings/webview/UserPackageWrapperImpl.java
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.webview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.webkit.UserPackage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Default implementation of UserPackageWrapper.
|
||||
*/
|
||||
class UserPackageWrapperImpl implements UserPackageWrapper {
|
||||
private final UserPackage mUserPackage;
|
||||
|
||||
UserPackageWrapperImpl(UserPackage userPackage) {
|
||||
mUserPackage = userPackage;
|
||||
}
|
||||
|
||||
public UserInfo getUserInfo() {
|
||||
return mUserPackage.getUserInfo();
|
||||
}
|
||||
|
||||
public PackageInfo getPackageInfo() {
|
||||
return mUserPackage.getPackageInfo();
|
||||
}
|
||||
|
||||
public boolean isEnabledPackage() {
|
||||
return mUserPackage.isEnabledPackage();
|
||||
}
|
||||
|
||||
public boolean isInstalledPackage() {
|
||||
return mUserPackage.isInstalledPackage();
|
||||
}
|
||||
}
|
126
src/com/android/settings/webview/WebViewAppListAdapter.java
Normal file
126
src/com/android/settings/webview/WebViewAppListAdapter.java
Normal file
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.webview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.RemoteException;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
||||
import com.android.settings.applications.AppViewHolder;
|
||||
import com.android.settings.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Custom list adapter for Settings to choose WebView package.
|
||||
* Note: parts of this class are copied from AppPicker.java.
|
||||
*/
|
||||
class WebViewAppListAdapter extends ArrayAdapter<WebViewApplicationInfo> {
|
||||
private final LayoutInflater mInflater;
|
||||
|
||||
public WebViewAppListAdapter(Context context,
|
||||
WebViewUpdateServiceWrapper webviewUpdateServiceWrapper) {
|
||||
super(context, 0);
|
||||
mInflater = LayoutInflater.from(context);
|
||||
|
||||
final List<WebViewApplicationInfo> packageInfoList =
|
||||
new ArrayList<WebViewApplicationInfo>();
|
||||
List<ApplicationInfo> pkgs =
|
||||
webviewUpdateServiceWrapper.getValidWebViewApplicationInfos(getContext());
|
||||
for (ApplicationInfo ai : pkgs) {
|
||||
WebViewApplicationInfo info = new WebViewApplicationInfo(ai,
|
||||
ai.loadLabel(context.getPackageManager()).toString(),
|
||||
getDisabledReason(webviewUpdateServiceWrapper, context, ai.packageName));
|
||||
packageInfoList.add(info);
|
||||
}
|
||||
addAll(packageInfoList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
// A ViewHolder keeps references to children views to avoid unnecessary calls
|
||||
// to findViewById() on each row.
|
||||
AppViewHolder holder = AppViewHolder.createOrRecycle(mInflater, convertView);
|
||||
convertView = holder.rootView;
|
||||
WebViewApplicationInfo info = getItem(position);
|
||||
holder.appName.setText(info.label);
|
||||
if (info.info != null) {
|
||||
holder.appIcon.setImageDrawable(info.info.loadIcon(getContext().getPackageManager()));
|
||||
// Allow disable-description to wrap - to be able to show several lines of text in case
|
||||
// a package is disabled/uninstalled for several users.
|
||||
holder.summary.setSingleLine(false);
|
||||
if (!isEnabled(position)) {
|
||||
holder.summary.setText(info.disabledReason);
|
||||
} else {
|
||||
holder.summary.setText("");
|
||||
}
|
||||
} else {
|
||||
holder.appIcon.setImageDrawable(null);
|
||||
holder.summary.setText("");
|
||||
}
|
||||
holder.disabled.setVisibility(View.GONE);
|
||||
// Only allow a package to be chosen if it is enabled and installed for all users.
|
||||
convertView.setEnabled(isEnabled(position));
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled (int position) {
|
||||
WebViewApplicationInfo info = getItem(position);
|
||||
return info.disabledReason == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areAllItemsEnabled() {
|
||||
int numItems = getCount();
|
||||
for (int n = 0; n < numItems; n++) {
|
||||
if (!isEnabled(n)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the reason why a package cannot be used as WebView implementation.
|
||||
* This is either because of it being disabled, uninstalled, or hidden for any user.
|
||||
*/
|
||||
@VisibleForTesting
|
||||
static String getDisabledReason(WebViewUpdateServiceWrapper webviewUpdateServiceWrapper,
|
||||
Context context, String packageName) {
|
||||
StringBuilder disabledReason = new StringBuilder();
|
||||
List<UserPackageWrapper> userPackages =
|
||||
webviewUpdateServiceWrapper.getPackageInfosAllUsers(context, packageName);
|
||||
for (UserPackageWrapper userPackage : userPackages) {
|
||||
if (!userPackage.isInstalledPackage()) {
|
||||
// Package uninstalled/hidden
|
||||
disabledReason.append(context.getString(
|
||||
R.string.webview_uninstalled_for_user, userPackage.getUserInfo().name));
|
||||
} else if (!userPackage.isEnabledPackage()) {
|
||||
// Package disabled
|
||||
disabledReason.append(context.getString(
|
||||
R.string.webview_disabled_for_user, userPackage.getUserInfo().name));
|
||||
}
|
||||
}
|
||||
if (disabledReason.length() == 0) return null;
|
||||
return disabledReason.toString();
|
||||
}
|
||||
}
|
||||
|
95
src/com/android/settings/webview/WebViewAppPicker.java
Normal file
95
src/com/android/settings/webview/WebViewAppPicker.java
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.webview;
|
||||
|
||||
import android.app.ListActivity;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.RemoteException;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.webkit.WebViewFactory;
|
||||
import android.widget.ListView;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.core.instrumentation.Instrumentable;
|
||||
import com.android.settings.core.instrumentation.VisibilityLoggerMixin;
|
||||
|
||||
public class WebViewAppPicker extends ListActivity implements Instrumentable {
|
||||
private static final String TAG = WebViewAppPicker.class.getSimpleName();
|
||||
private WebViewAppListAdapter mAdapter;
|
||||
private WebViewUpdateServiceWrapper mWebViewUpdateServiceWrapper;
|
||||
|
||||
private final VisibilityLoggerMixin mVisibilityLoggerMixin =
|
||||
new VisibilityLoggerMixin(getMetricsCategory());
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
if (mWebViewUpdateServiceWrapper == null) {
|
||||
setWebViewUpdateServiceWrapper(createDefaultWebViewUpdateServiceWrapper());
|
||||
}
|
||||
mAdapter = new WebViewAppListAdapter(this, mWebViewUpdateServiceWrapper);
|
||||
setListAdapter(mAdapter);
|
||||
|
||||
mVisibilityLoggerMixin.onAttach(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onListItemClick(ListView l, View v, int position, long id) {
|
||||
WebViewApplicationInfo app = mAdapter.getItem(position);
|
||||
|
||||
if (mWebViewUpdateServiceWrapper.setWebViewProvider(app.info.packageName)) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(app.info.packageName);
|
||||
setResult(RESULT_OK, intent);
|
||||
} else {
|
||||
mWebViewUpdateServiceWrapper.showInvalidChoiceToast(this);
|
||||
}
|
||||
finish();
|
||||
}
|
||||
|
||||
private WebViewUpdateServiceWrapper createDefaultWebViewUpdateServiceWrapper() {
|
||||
return new WebViewUpdateServiceWrapper();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void setWebViewUpdateServiceWrapper(WebViewUpdateServiceWrapper wvusWrapper) {
|
||||
mWebViewUpdateServiceWrapper = wvusWrapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mVisibilityLoggerMixin.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mVisibilityLoggerMixin.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetricsCategory() {
|
||||
return MetricsEvent.WEBVIEW_IMPLEMENTATION;
|
||||
}
|
||||
}
|
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.webview;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.DevelopmentSettings;
|
||||
import com.android.settings.core.PreferenceController;
|
||||
|
||||
public class WebViewAppPreferenceController extends PreferenceController {
|
||||
|
||||
private static final String WEBVIEW_APP_KEY = "select_webview_provider";
|
||||
|
||||
private Context mContext;
|
||||
private Preference mPreference;
|
||||
private final WebViewUpdateServiceWrapper mWebViewUpdateServiceWrapper;
|
||||
|
||||
public WebViewAppPreferenceController(Context context) {
|
||||
this(context, new WebViewUpdateServiceWrapper());
|
||||
}
|
||||
|
||||
public WebViewAppPreferenceController(Context context,
|
||||
WebViewUpdateServiceWrapper webviewUpdateServiceWrapper) {
|
||||
super(context);
|
||||
mContext = context;
|
||||
mWebViewUpdateServiceWrapper = webviewUpdateServiceWrapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handlePreferenceTreeClick(Preference preference) {
|
||||
if (getPreferenceKey().equals(preference.getKey())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Intent getActivityIntent() {
|
||||
return new Intent(mContext, WebViewAppPicker.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateState(Preference preference) {
|
||||
mPreference.setSummary(getCurrentWebViewPackageLabel(mContext));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
if (isAvailable()) {
|
||||
mPreference = screen.findPreference(WEBVIEW_APP_KEY);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the return-value from the WebViewAppPicker Activity.
|
||||
*/
|
||||
public void onActivityResult(int resultCode, Intent data) {
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
updateState(null);
|
||||
}
|
||||
}
|
||||
|
||||
private String getCurrentWebViewPackageLabel(Context context) {
|
||||
PackageInfo webViewPackage = mWebViewUpdateServiceWrapper.getCurrentWebViewPackage();
|
||||
if (webViewPackage == null) return "";
|
||||
return webViewPackage.applicationInfo.loadLabel(context.getPackageManager()).toString();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getPreferenceKey() {
|
||||
return WEBVIEW_APP_KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void enablePreference(boolean enabled) {
|
||||
if (isAvailable()) {
|
||||
mPreference.setEnabled(enabled);
|
||||
}
|
||||
}
|
||||
}
|
29
src/com/android/settings/webview/WebViewApplicationInfo.java
Normal file
29
src/com/android/settings/webview/WebViewApplicationInfo.java
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the
|
||||
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the specific language governing
|
||||
* permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.webview;
|
||||
|
||||
import android.content.pm.ApplicationInfo;
|
||||
|
||||
final class WebViewApplicationInfo {
|
||||
final ApplicationInfo info;
|
||||
final String label;
|
||||
final String disabledReason;
|
||||
|
||||
public WebViewApplicationInfo(ApplicationInfo info, String label, String disabledReason) {
|
||||
this.info = info;
|
||||
this.label = label;
|
||||
this.disabledReason = disabledReason;
|
||||
}
|
||||
}
|
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.webview;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
import android.webkit.UserPackage;
|
||||
import android.webkit.WebViewFactory;
|
||||
import android.webkit.WebViewProviderInfo;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
class WebViewUpdateServiceWrapper {
|
||||
private static final String TAG = "WVUSWrapper";
|
||||
|
||||
public WebViewUpdateServiceWrapper() {}
|
||||
|
||||
/**
|
||||
* Fetch the package currently used as WebView implementation.
|
||||
*/
|
||||
public PackageInfo getCurrentWebViewPackage() {
|
||||
try {
|
||||
return WebViewFactory.getUpdateService().getCurrentWebViewPackage();
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, e.toString());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches ApplicationInfo objects for all currently valid WebView packages.
|
||||
* A WebView package is considered valid if it can be used as a WebView implementation. The
|
||||
* validity of a package is not dependent on whether the package is installed/enabled.
|
||||
*/
|
||||
public List<ApplicationInfo> getValidWebViewApplicationInfos(Context context) {
|
||||
WebViewProviderInfo[] providers = null;
|
||||
try {
|
||||
providers = WebViewFactory.getUpdateService().getValidWebViewPackages();
|
||||
} catch (RemoteException e) {
|
||||
}
|
||||
List<ApplicationInfo> pkgs = new ArrayList<>();
|
||||
for (WebViewProviderInfo provider : providers) {
|
||||
try {
|
||||
pkgs.add(context.getPackageManager().getApplicationInfo(
|
||||
provider.packageName, PACKAGE_FLAGS));
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
}
|
||||
}
|
||||
return pkgs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change WebView provider to {@param packageName}.
|
||||
* @return whether the change succeeded.
|
||||
*/
|
||||
public boolean setWebViewProvider(String packageName) {
|
||||
try {
|
||||
return packageName.equals(
|
||||
WebViewFactory.getUpdateService().changeProviderAndSetting(packageName));
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "RemoteException when trying to change provider to " + packageName, e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch PackageInfos for the package named {@param packageName} for all users on the device.
|
||||
*/
|
||||
public List<UserPackageWrapper> getPackageInfosAllUsers(Context context, String packageName) {
|
||||
List<UserPackageWrapper> userPackageWrappers = new ArrayList<>();
|
||||
List<UserPackage> userPackages =
|
||||
UserPackage.getPackageInfosAllUsers(context, packageName, PACKAGE_FLAGS);
|
||||
for (UserPackage userPackage : userPackages) {
|
||||
userPackageWrappers.add(new UserPackageWrapperImpl(userPackage));
|
||||
}
|
||||
return userPackageWrappers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a toast to explain the chosen package can no longer be chosen.
|
||||
*/
|
||||
public void showInvalidChoiceToast(Context context) {
|
||||
// The user chose a package that became invalid since the list was last updated,
|
||||
// show a Toast to explain the situation.
|
||||
Toast toast = Toast.makeText(context,
|
||||
R.string.select_webview_provider_toast_text, Toast.LENGTH_SHORT);
|
||||
toast.show();
|
||||
}
|
||||
|
||||
static final int PACKAGE_FLAGS = PackageManager.MATCH_ANY_USER;
|
||||
}
|
Reference in New Issue
Block a user