import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
-import android.os.RemoteException;
-import android.os.ServiceManager;
import android.os.UserHandle;
import android.os.UserManager;
import android.util.Log;
import android.view.View;
-import android.webkit.IWebViewUpdateService;
import androidx.annotation.VisibleForTesting;
import androidx.fragment.app.Fragment;
enabled = false;
}
- if (isFallbackPackage(mAppEntry.info.packageName)) {
- enabled = false;
- }
-
mButtonsPref.setButton2Enabled(enabled);
}
}
@VisibleForTesting
- boolean isFallbackPackage(String packageName) {
- try {
- IWebViewUpdateService webviewUpdateService =
- IWebViewUpdateService.Stub.asInterface(
- ServiceManager.getService("webviewupdate"));
- if (webviewUpdateService.isFallbackPackage(packageName)) {
- return true;
- }
- } catch (RemoteException e) {
- throw new RuntimeException(e);
- }
-
- return false;
- }
-
- @VisibleForTesting
void updateForceStopButton() {
if (mDpm.packageHasActiveAdmins(mPackageInfo.packageName)) {
// User can't force stop device admin.
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
-import android.webkit.IWebViewUpdateService;
import androidx.appcompat.app.AlertDialog;
private final PackageManager mPm;
private final IPackageManager mIPm;
private final INotificationManager mNm;
- private final IWebViewUpdateService mWvus;
private final NetworkPolicyManager mNpm;
private final AppOpsManager mAom;
private final Context mContext;
mIPm = IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
mNm = INotificationManager.Stub.asInterface(
ServiceManager.getService(Context.NOTIFICATION_SERVICE));
- mWvus = IWebViewUpdateService.Stub.asInterface(ServiceManager.getService("webviewupdate"));
mNpm = NetworkPolicyManager.from(context);
mAom = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
}
}
if (!app.enabled) {
if (mPm.getApplicationEnabledSetting(app.packageName)
- == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER
- && !isNonEnableableFallback(app.packageName)) {
+ == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_USER) {
mPm.setApplicationEnabledSetting(app.packageName,
PackageManager.COMPONENT_ENABLED_STATE_DEFAULT,
PackageManager.DONT_KILL_APP);
}
});
}
-
- private boolean isNonEnableableFallback(String packageName) {
- try {
- return mWvus.isFallbackPackage(packageName);
- } catch (RemoteException e) {
- throw new RuntimeException(e);
- }
- }
}
mController = spy(new AppButtonsPreferenceController(mSettingsActivity, mFragment,
mLifecycle, PACKAGE_NAME, mState, REQUEST_UNINSTALL, REQUEST_REMOVE_DEVICE_ADMIN));
- doReturn(false).when(mController).isFallbackPackage(anyString());
mAppEntry.info = mAppInfo;
mAppInfo.packageName = PACKAGE_NAME;