Skip to content

Commit 833770d

Browse files
author
android-build-team Robot
committed
Merge cherrypicks of [3594034, 3594272, 3594273, 3594274, 3594275, 3594347, 3594035, 3592471] into oc-mr1-release
Change-Id: Id0214b5206fd01da1829b1475cef34ecac46f4e2
2 parents 2963cd4 + db0f510 commit 833770d

3 files changed

Lines changed: 38 additions & 15 deletions

File tree

packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,18 +1687,9 @@ private Set<String> getOverlayInstantAppAccessibleSettings(int settingsType) {
16871687
}
16881688

16891689
private List<String> getSettingsNamesLocked(int settingsType, int userId) {
1690-
boolean instantApp;
1691-
if (UserHandle.getAppId(Binder.getCallingUid()) < Process.FIRST_APPLICATION_UID) {
1692-
instantApp = false;
1693-
} else {
1694-
ApplicationInfo ai = getCallingApplicationInfoOrThrow();
1695-
instantApp = ai.isInstantApp();
1696-
}
1697-
if (instantApp) {
1698-
return new ArrayList<String>(getInstantAppAccessibleSettings(settingsType));
1699-
} else {
1700-
return mSettingsRegistry.getSettingsNamesLocked(settingsType, userId);
1701-
}
1690+
// Don't enforce the instant app whitelist for now -- its too prone to unintended breakage
1691+
// in the current form.
1692+
return mSettingsRegistry.getSettingsNamesLocked(settingsType, userId);
17021693
}
17031694

17041695
private void enforceSettingReadable(String settingName, int settingsType, int userId) {
@@ -1711,8 +1702,10 @@ private void enforceSettingReadable(String settingName, int settingsType, int us
17111702
}
17121703
if (!getInstantAppAccessibleSettings(settingsType).contains(settingName)
17131704
&& !getOverlayInstantAppAccessibleSettings(settingsType).contains(settingName)) {
1714-
throw new SecurityException("Setting " + settingName + " is not accessible from"
1715-
+ " ephemeral package " + getCallingPackage());
1705+
// Don't enforce the instant app whitelist for now -- its too prone to unintended
1706+
// breakage in the current form.
1707+
Slog.w(LOG_TAG, "Instant App " + ai.packageName
1708+
+ " trying to access unexposed setting, this will be an error in the future.");
17161709
}
17171710
}
17181711

services/core/java/com/android/server/ConnectivityService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,8 @@ public NetworkQuotaInfo getActiveNetworkQuotaInfo() {
13391339
public boolean isActiveNetworkMetered() {
13401340
enforceAccessPermission();
13411341

1342-
final NetworkCapabilities caps = getNetworkCapabilities(getActiveNetwork());
1342+
final int uid = Binder.getCallingUid();
1343+
final NetworkCapabilities caps = getUnfilteredActiveNetworkState(uid).networkCapabilities;
13431344
if (caps != null) {
13441345
return !caps.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED);
13451346
} else {

services/core/java/com/android/server/notification/ManagedServices.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@
3939
import android.content.pm.UserInfo;
4040
import android.os.Binder;
4141
import android.os.Build;
42+
import android.os.Handler;
4243
import android.os.IBinder;
4344
import android.os.IInterface;
45+
import android.os.Looper;
4446
import android.os.RemoteException;
4547
import android.os.UserHandle;
4648
import android.os.UserManager;
@@ -82,6 +84,7 @@ abstract public class ManagedServices {
8284
protected final String TAG = getClass().getSimpleName();
8385
protected final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
8486

87+
private static final int ON_BINDING_DIED_REBIND_DELAY_MS = 10000;
8588
protected static final String ENABLED_SERVICES_SEPARATOR = ":";
8689

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

105109
// contains connections to all connected services, including app services
106110
// and system services
107111
private final ArrayList<ManagedServiceInfo> mServices = new ArrayList<>();
108112
// things that will be put into mServices as soon as they're ready
109113
private final ArrayList<String> mServicesBinding = new ArrayList<>();
114+
private final ArraySet<String> mServicesRebinding = new ArraySet<>();
115+
110116
// lists the component names of all enabled (and therefore potentially connected)
111117
// app services for current profiles.
112118
private ArraySet<ComponentName> mEnabledServicesForCurrentProfiles
@@ -823,6 +829,7 @@ private void registerServiceLocked(final ComponentName name, final int userid,
823829

824830
final String servicesBindingTag = name.toString() + "/" + userid;
825831
if (mServicesBinding.contains(servicesBindingTag)) {
832+
Slog.v(TAG, "Not registering " + name + " as bind is already in progress");
826833
// stop registering this thing already! we're working on it
827834
return;
828835
}
@@ -871,6 +878,7 @@ public void onServiceConnected(ComponentName name, IBinder binder) {
871878
boolean added = false;
872879
ManagedServiceInfo info = null;
873880
synchronized (mMutex) {
881+
mServicesRebinding.remove(servicesBindingTag);
874882
mServicesBinding.remove(servicesBindingTag);
875883
try {
876884
mService = asInterface(binder);
@@ -892,6 +900,27 @@ public void onServiceDisconnected(ComponentName name) {
892900
mServicesBinding.remove(servicesBindingTag);
893901
Slog.v(TAG, getCaption() + " connection lost: " + name);
894902
}
903+
904+
@Override
905+
public void onBindingDied(ComponentName name) {
906+
Slog.w(TAG, getCaption() + " binding died: " + name);
907+
synchronized (mMutex) {
908+
mServicesBinding.remove(servicesBindingTag);
909+
mContext.unbindService(this);
910+
if (!mServicesRebinding.contains(servicesBindingTag)) {
911+
mServicesRebinding.add(servicesBindingTag);
912+
mHandler.postDelayed(new Runnable() {
913+
@Override
914+
public void run() {
915+
registerService(name, userid);
916+
}
917+
}, ON_BINDING_DIED_REBIND_DELAY_MS);
918+
} else {
919+
Slog.v(TAG, getCaption() + " not rebinding as "
920+
+ "a previous rebind attempt was made: " + name);
921+
}
922+
}
923+
}
895924
};
896925
if (!mContext.bindServiceAsUser(intent,
897926
serviceConnection,

0 commit comments

Comments
 (0)