am 5d1122a3: Merge "Fix issue #7016987: Unable to attach a picture in gmail/emaill composer action." into jb-mr1-dev
* commit '5d1122a3f84e1df80c63aca56310f2cf29bea7dc': Fix issue #7016987: Unable to attach a picture in gmail/emaill composer action.
This commit is contained in:
@@ -48,6 +48,7 @@ import android.os.Looper;
|
|||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.StrictMode;
|
import android.os.StrictMode;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.text.Selection;
|
import android.text.Selection;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@@ -3383,6 +3384,31 @@ public class Activity extends ContextThemeWrapper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide Implement to provide correct calling token.
|
||||||
|
*/
|
||||||
|
public void startActivityAsUser(Intent intent, UserHandle user) {
|
||||||
|
startActivityAsUser(intent, null, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @hide Implement to provide correct calling token.
|
||||||
|
*/
|
||||||
|
public void startActivityAsUser(Intent intent, Bundle options, UserHandle user) {
|
||||||
|
if (mParent != null) {
|
||||||
|
throw new RuntimeException("Called be called from a child");
|
||||||
|
}
|
||||||
|
Instrumentation.ActivityResult ar =
|
||||||
|
mInstrumentation.execStartActivity(
|
||||||
|
this, mMainThread.getApplicationThread(), mToken, this,
|
||||||
|
intent, -1, options, user);
|
||||||
|
if (ar != null) {
|
||||||
|
mMainThread.sendActivityResult(
|
||||||
|
mToken, mEmbeddedID, -1, ar.getResultCode(),
|
||||||
|
ar.getResultData());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as calling {@link #startIntentSenderForResult(IntentSender, int,
|
* Same as calling {@link #startIntentSenderForResult(IntentSender, int,
|
||||||
* Intent, int, int, int, Bundle)} with no options.
|
* Intent, int, int, int, Bundle)} with no options.
|
||||||
|
|||||||
@@ -909,14 +909,7 @@ class ContextImpl extends Context {
|
|||||||
/** @hide */
|
/** @hide */
|
||||||
@Override
|
@Override
|
||||||
public void startActivityAsUser(Intent intent, UserHandle user) {
|
public void startActivityAsUser(Intent intent, UserHandle user) {
|
||||||
try {
|
startActivityAsUser(intent, null, user);
|
||||||
ActivityManagerNative.getDefault().startActivityAsUser(
|
|
||||||
mMainThread.getApplicationThread(), intent,
|
|
||||||
intent.resolveTypeIfNeeded(getContentResolver()),
|
|
||||||
null, null, 0, Intent.FLAG_ACTIVITY_NEW_TASK, null, null, null,
|
|
||||||
user.getIdentifier());
|
|
||||||
} catch (RemoteException re) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import android.os.Process;
|
|||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
import android.os.UserHandle;
|
||||||
import android.util.AndroidRuntimeException;
|
import android.util.AndroidRuntimeException;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.IWindowManager;
|
import android.view.IWindowManager;
|
||||||
@@ -1518,6 +1519,66 @@ public class Instrumentation {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Like {@link #execStartActivity(Context, IBinder, IBinder, Activity, Intent, int)},
|
||||||
|
* but for starting as a particular user.
|
||||||
|
*
|
||||||
|
* @param who The Context from which the activity is being started.
|
||||||
|
* @param contextThread The main thread of the Context from which the activity
|
||||||
|
* is being started.
|
||||||
|
* @param token Internal token identifying to the system who is starting
|
||||||
|
* the activity; may be null.
|
||||||
|
* @param target Which fragment is performing the start (and thus receiving
|
||||||
|
* any result).
|
||||||
|
* @param intent The actual Intent to start.
|
||||||
|
* @param requestCode Identifier for this request's result; less than zero
|
||||||
|
* if the caller is not expecting a result.
|
||||||
|
*
|
||||||
|
* @return To force the return of a particular result, return an
|
||||||
|
* ActivityResult object containing the desired data; otherwise
|
||||||
|
* return null. The default implementation always returns null.
|
||||||
|
*
|
||||||
|
* @throws android.content.ActivityNotFoundException
|
||||||
|
*
|
||||||
|
* @see Activity#startActivity(Intent)
|
||||||
|
* @see Activity#startActivityForResult(Intent, int)
|
||||||
|
* @see Activity#startActivityFromChild
|
||||||
|
*
|
||||||
|
* {@hide}
|
||||||
|
*/
|
||||||
|
public ActivityResult execStartActivity(
|
||||||
|
Context who, IBinder contextThread, IBinder token, Activity target,
|
||||||
|
Intent intent, int requestCode, Bundle options, UserHandle user) {
|
||||||
|
IApplicationThread whoThread = (IApplicationThread) contextThread;
|
||||||
|
if (mActivityMonitors != null) {
|
||||||
|
synchronized (mSync) {
|
||||||
|
final int N = mActivityMonitors.size();
|
||||||
|
for (int i=0; i<N; i++) {
|
||||||
|
final ActivityMonitor am = mActivityMonitors.get(i);
|
||||||
|
if (am.match(who, null, intent)) {
|
||||||
|
am.mHits++;
|
||||||
|
if (am.isBlocking()) {
|
||||||
|
return requestCode >= 0 ? am.getResult() : null;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
intent.setAllowFds(false);
|
||||||
|
intent.migrateExtraStreamToClipData();
|
||||||
|
int result = ActivityManagerNative.getDefault()
|
||||||
|
.startActivityAsUser(whoThread, intent,
|
||||||
|
intent.resolveTypeIfNeeded(who.getContentResolver()),
|
||||||
|
token, target != null ? target.mEmbeddedID : null,
|
||||||
|
requestCode, 0, null, null, options, user.getIdentifier());
|
||||||
|
checkStartActivityResult(result, intent);
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/*package*/ final void init(ActivityThread thread,
|
/*package*/ final void init(ActivityThread thread,
|
||||||
Context instrContext, Context appContext, ComponentName component,
|
Context instrContext, Context appContext, ComponentName component,
|
||||||
IInstrumentationWatcher watcher) {
|
IInstrumentationWatcher watcher) {
|
||||||
|
|||||||
Reference in New Issue
Block a user