Merge "Skip publishContentProviders() when we have zero." into nyc-dev

am: 2d4d61d326

* commit '2d4d61d3268a1f1af6b0835eb346bec587983050':
  Skip publishContentProviders() when we have zero.
This commit is contained in:
Jeff Sharkey
2016-03-06 02:54:53 +00:00
committed by android-build-merger
3 changed files with 14 additions and 6 deletions

View File

@@ -113,6 +113,7 @@ import com.android.internal.os.BinderInternal;
import com.android.internal.os.RuntimeInit;
import com.android.internal.os.SamplingProfilerIntegration;
import com.android.internal.os.SomeArgs;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.FastPrintWriter;
import com.android.org.conscrypt.OpenSSLSocketImpl;
import com.android.org.conscrypt.TrustedCertificateStore;
@@ -5264,9 +5265,8 @@ public final class ActivityThread {
// don't bring up providers in restricted mode; they may depend on the
// app's custom Application class
if (!data.restrictedBackupMode) {
List<ProviderInfo> providers = data.providers;
if (providers != null) {
installContentProviders(app, providers);
if (!ArrayUtils.isEmpty(data.providers)) {
installContentProviders(app, data.providers);
// For process that contains content providers, we want to
// ensure that the JIT is enabled "at some point".
mH.sendEmptyMessageDelayed(H.ENABLE_JIT, 10*1000);

View File

@@ -27,6 +27,7 @@ import libcore.util.EmptyArray;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
/**
@@ -123,6 +124,13 @@ public class ArrayUtils {
return (T[]) cache;
}
/**
* Checks if given array is null or has zero elements.
*/
public static boolean isEmpty(@Nullable List<?> array) {
return array == null || array.isEmpty();
}
/**
* Checks if given array is null or has zero elements.
*/

View File

@@ -9908,11 +9908,11 @@ public final class ActivityManagerService extends ActivityManagerNative
private final List<ProviderInfo> generateApplicationProvidersLocked(ProcessRecord app) {
List<ProviderInfo> providers = null;
try {
ParceledListSlice<ProviderInfo> slice = AppGlobals.getPackageManager()
providers = AppGlobals.getPackageManager()
.queryContentProviders(app.processName, app.uid,
STOCK_PM_FLAGS | PackageManager.GET_URI_PERMISSION_PATTERNS
| MATCH_DEBUG_TRIAGED_MISSING);
providers = slice != null ? slice.getList() : null;
| MATCH_DEBUG_TRIAGED_MISSING)
.getList();
} catch (RemoteException ex) {
}
if (DEBUG_MU) Slog.v(TAG_MU,