Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 833770d2 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Merge cherrypicks of [3594034, 3594272, 3594273, 3594274, 3594275, 3594347,...

Merge cherrypicks of [3594034, 3594272, 3594273, 3594274, 3594275, 3594347, 3594035, 3592471] into oc-mr1-release

Change-Id: Id0214b5206fd01da1829b1475cef34ecac46f4e2
parents 2963cd41 db0f5100
Loading
Loading
Loading
Loading
+7 −14
Original line number Diff line number Diff line
@@ -1687,19 +1687,10 @@ public class SettingsProvider extends ContentProvider {
    }

    private List<String> getSettingsNamesLocked(int settingsType, int userId) {
        boolean instantApp;
        if (UserHandle.getAppId(Binder.getCallingUid()) < Process.FIRST_APPLICATION_UID) {
            instantApp = false;
        } else {
            ApplicationInfo ai = getCallingApplicationInfoOrThrow();
            instantApp = ai.isInstantApp();
        }
        if (instantApp) {
            return new ArrayList<String>(getInstantAppAccessibleSettings(settingsType));
        } else {
        // Don't enforce the instant app whitelist for now -- its too prone to unintended breakage
        // in the current form.
        return mSettingsRegistry.getSettingsNamesLocked(settingsType, userId);
    }
    }

    private void enforceSettingReadable(String settingName, int settingsType, int userId) {
        if (UserHandle.getAppId(Binder.getCallingUid()) < Process.FIRST_APPLICATION_UID) {
@@ -1711,8 +1702,10 @@ public class SettingsProvider extends ContentProvider {
        }
        if (!getInstantAppAccessibleSettings(settingsType).contains(settingName)
                && !getOverlayInstantAppAccessibleSettings(settingsType).contains(settingName)) {
            throw new SecurityException("Setting " + settingName + " is not accessible from"
                    + " ephemeral package " + getCallingPackage());
            // Don't enforce the instant app whitelist for now -- its too prone to unintended
            // breakage in the current form.
            Slog.w(LOG_TAG, "Instant App " + ai.packageName
                    + " trying to access unexposed setting, this will be an error in the future.");
        }
    }

+2 −1
Original line number Diff line number Diff line
@@ -1339,7 +1339,8 @@ public class ConnectivityService extends IConnectivityManager.Stub
    public boolean isActiveNetworkMetered() {
        enforceAccessPermission();

        final NetworkCapabilities caps = getNetworkCapabilities(getActiveNetwork());
        final int uid = Binder.getCallingUid();
        final NetworkCapabilities caps = getUnfilteredActiveNetworkState(uid).networkCapabilities;
        if (caps != null) {
            return !caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED);
        } else {
+29 −0
Original line number Diff line number Diff line
@@ -39,8 +39,10 @@ import android.content.pm.ServiceInfo;
import android.content.pm.UserInfo;
import android.os.Binder;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.os.IInterface;
import android.os.Looper;
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
@@ -82,6 +84,7 @@ abstract public class ManagedServices {
    protected final String TAG = getClass().getSimpleName();
    protected final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);

    private static final int ON_BINDING_DIED_REBIND_DELAY_MS = 10000;
    protected static final String ENABLED_SERVICES_SEPARATOR = ":";

    /**
@@ -101,12 +104,15 @@ abstract public class ManagedServices {
    private final IPackageManager mPm;
    private final UserManager mUm;
    private final Config mConfig;
    private final Handler mHandler = new Handler(Looper.getMainLooper());

    // contains connections to all connected services, including app services
    // and system services
    private final ArrayList<ManagedServiceInfo> mServices = new ArrayList<>();
    // things that will be put into mServices as soon as they're ready
    private final ArrayList<String> mServicesBinding = new ArrayList<>();
    private final ArraySet<String> mServicesRebinding = new ArraySet<>();

    // lists the component names of all enabled (and therefore potentially connected)
    // app services for current profiles.
    private ArraySet<ComponentName> mEnabledServicesForCurrentProfiles
@@ -823,6 +829,7 @@ abstract public class ManagedServices {

        final String servicesBindingTag = name.toString() + "/" + userid;
        if (mServicesBinding.contains(servicesBindingTag)) {
            Slog.v(TAG, "Not registering " + name + " as bind is already in progress");
            // stop registering this thing already! we're working on it
            return;
        }
@@ -871,6 +878,7 @@ abstract public class ManagedServices {
                    boolean added = false;
                    ManagedServiceInfo info = null;
                    synchronized (mMutex) {
                        mServicesRebinding.remove(servicesBindingTag);
                        mServicesBinding.remove(servicesBindingTag);
                        try {
                            mService = asInterface(binder);
@@ -892,6 +900,27 @@ abstract public class ManagedServices {
                    mServicesBinding.remove(servicesBindingTag);
                    Slog.v(TAG, getCaption() + " connection lost: " + name);
                }

                @Override
                public void onBindingDied(ComponentName name) {
                    Slog.w(TAG, getCaption() + " binding died: " + name);
                    synchronized (mMutex) {
                        mServicesBinding.remove(servicesBindingTag);
                        mContext.unbindService(this);
                        if (!mServicesRebinding.contains(servicesBindingTag)) {
                            mServicesRebinding.add(servicesBindingTag);
                            mHandler.postDelayed(new Runnable() {
                                    @Override
                                    public void run() {
                                        registerService(name, userid);
                                    }
                               }, ON_BINDING_DIED_REBIND_DELAY_MS);
                        } else {
                            Slog.v(TAG, getCaption() + " not rebinding as "
                                    + "a previous rebind attempt was made: " + name);
                        }
                    }
                }
            };
            if (!mContext.bindServiceAsUser(intent,
                serviceConnection,