summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2013-10-08 17:01:30 -0700
committerJeff Sharkey <jsharkey@android.com>2013-10-08 17:02:26 -0700
commitdd97f4233fa8cca2a258c568f56a77c9bdc5fe74 (patch)
tree01678c97c87f1db406ed4bbd5ada093999dc6c46 /core/java
parenta6af40cda29837fb68507f431ee5a179db93de28 (diff)
downloadframeworks_base-dd97f4233fa8cca2a258c568f56a77c9bdc5fe74.zip
frameworks_base-dd97f4233fa8cca2a258c568f56a77c9bdc5fe74.tar.gz
frameworks_base-dd97f4233fa8cca2a258c568f56a77c9bdc5fe74.tar.bz2
Install providers enabled after app started.
When an app has already been started, and a ContentProvider component is enabled with DONT_KILL_APP, use the existing ProcessRecord to install the provider. Bug: 11118692 Change-Id: I990f18b337eb19768ee1db895f1e2eb982046cce
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/ActivityThread.java15
-rw-r--r--core/java/android/app/ApplicationThreadNative.java18
-rw-r--r--core/java/android/app/IApplicationThread.java2
3 files changed, 35 insertions, 0 deletions
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index e07b50f..df63ab3 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -95,6 +95,7 @@ import com.android.internal.os.SamplingProfilerIntegration;
import com.android.internal.util.FastPrintWriter;
import com.android.internal.util.Objects;
import com.android.org.conscrypt.OpenSSLSocketImpl;
+import com.google.android.collect.Lists;
import java.io.File;
import java.io.FileDescriptor;
@@ -1277,6 +1278,11 @@ public final class ActivityThread {
}
}
}
+
+ @Override
+ public void scheduleInstallProvider(ProviderInfo provider) {
+ queueOrSendMessage(H.INSTALL_PROVIDER, provider);
+ }
}
private class H extends Handler {
@@ -1325,6 +1331,7 @@ public final class ActivityThread {
public static final int UNSTABLE_PROVIDER_DIED = 142;
public static final int REQUEST_ASSIST_CONTEXT_EXTRAS = 143;
public static final int TRANSLUCENT_CONVERSION_COMPLETE = 144;
+ public static final int INSTALL_PROVIDER = 145;
String codeToString(int code) {
if (DEBUG_MESSAGES) {
switch (code) {
@@ -1373,6 +1380,7 @@ public final class ActivityThread {
case UNSTABLE_PROVIDER_DIED: return "UNSTABLE_PROVIDER_DIED";
case REQUEST_ASSIST_CONTEXT_EXTRAS: return "REQUEST_ASSIST_CONTEXT_EXTRAS";
case TRANSLUCENT_CONVERSION_COMPLETE: return "TRANSLUCENT_CONVERSION_COMPLETE";
+ case INSTALL_PROVIDER: return "INSTALL_PROVIDER";
}
}
return Integer.toString(code);
@@ -1590,6 +1598,9 @@ public final class ActivityThread {
case TRANSLUCENT_CONVERSION_COMPLETE:
handleTranslucentConversionComplete((IBinder)msg.obj, msg.arg1 == 1);
break;
+ case INSTALL_PROVIDER:
+ handleInstallProvider((ProviderInfo) msg.obj);
+ break;
}
if (DEBUG_MESSAGES) Slog.v(TAG, "<<< done: " + codeToString(msg.what));
}
@@ -2330,6 +2341,10 @@ public final class ActivityThread {
}
}
+ public void handleInstallProvider(ProviderInfo info) {
+ installContentProviders(mInitialApplication, Lists.newArrayList(info));
+ }
+
private static final ThreadLocal<Intent> sCurrentBroadcastIntent = new ThreadLocal<Intent>();
/**
diff --git a/core/java/android/app/ApplicationThreadNative.java b/core/java/android/app/ApplicationThreadNative.java
index e40a04b..347d43f 100644
--- a/core/java/android/app/ApplicationThreadNative.java
+++ b/core/java/android/app/ApplicationThreadNative.java
@@ -618,6 +618,15 @@ public abstract class ApplicationThreadNative extends Binder
reply.writeNoException();
return true;
}
+
+ case SCHEDULE_INSTALL_PROVIDER_TRANSACTION:
+ {
+ data.enforceInterface(IApplicationThread.descriptor);
+ ProviderInfo provider = ProviderInfo.CREATOR.createFromParcel(data);
+ scheduleInstallProvider(provider);
+ reply.writeNoException();
+ return true;
+ }
}
return super.onTransact(code, data, reply, flags);
@@ -1248,4 +1257,13 @@ class ApplicationThreadProxy implements IApplicationThread {
mRemote.transact(SET_PROCESS_STATE_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
data.recycle();
}
+
+ @Override
+ public void scheduleInstallProvider(ProviderInfo provider) throws RemoteException {
+ Parcel data = Parcel.obtain();
+ data.writeInterfaceToken(IApplicationThread.descriptor);
+ provider.writeToParcel(data, 0);
+ mRemote.transact(SCHEDULE_INSTALL_PROVIDER_TRANSACTION, data, null, IBinder.FLAG_ONEWAY);
+ data.recycle();
+ }
}
diff --git a/core/java/android/app/IApplicationThread.java b/core/java/android/app/IApplicationThread.java
index 43a5fbd..d0cc1bb 100644
--- a/core/java/android/app/IApplicationThread.java
+++ b/core/java/android/app/IApplicationThread.java
@@ -137,6 +137,7 @@ public interface IApplicationThread extends IInterface {
void scheduleTranslucentConversionComplete(IBinder token, boolean timeout)
throws RemoteException;
void setProcessState(int state) throws RemoteException;
+ void scheduleInstallProvider(ProviderInfo provider) throws RemoteException;
String descriptor = "android.app.IApplicationThread";
@@ -189,4 +190,5 @@ public interface IApplicationThread extends IInterface {
int REQUEST_ASSIST_CONTEXT_EXTRAS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+47;
int SCHEDULE_TRANSLUCENT_CONVERSION_COMPLETE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+48;
int SET_PROCESS_STATE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+49;
+ int SCHEDULE_INSTALL_PROVIDER_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+50;
}