/**
* A special variation to launch an activity only if a new activity
* instance is needed to handle the given Intent. In other words, this is
* just like {@link #startActivityForResult(Intent, int)} except: if you are
* using the {@link Intent#FLAG_ACTIVITY_SINGLE_TOP} flag, or
* singleTask or singleTop
* {@link android.R.styleable#AndroidManifestActivity_launchMode launchMode},
* and the activity
* that handles <var>intent</var> is the same as your currently running
* activity, then a new instance is not needed. In this case, instead of
* the normal behavior of calling {@link #onNewIntent} this function will
* return and you can handle the Intent yourself.
*
* <p>This function can only be called from a top-level activity; if it is
* called from a child activity, a runtime exception will be thrown.
*
* @param intent The intent to start.
* @param requestCode If >= 0, this code will be returned in
* onActivityResult() when the activity exits, as described in
* {@link #startActivityForResult}.
* @param options Additional options for how the Activity should be started.
* See {@link android.content.Context#startActivity(Intent, Bundle)
* Context.startActivity(Intent, Bundle)} for more details.
*
* @return If a new activity was launched then true is returned; otherwise
* false is returned and you must handle the Intent yourself.
*
* @see #startActivity
* @see #startActivityForResult
*/
public boolean startActivityIfNeeded(@RequiresPermission @NonNull Intent intent,
int requestCode, @Nullable Bundle options) {
if (mParent == null) {
int result = ActivityManager.START_RETURN_INTENT_TO_CALLER;
try {
Uri referrer = onProvideReferrer();
if (referrer != null) {
intent.putExtra(Intent.EXTRA_REFERRER, referrer);
}
intent.migrateExtraStreamToClipData();
intent.prepareToLeaveProcess(this);
result = ActivityManagerNative.getDefault()
.startActivity(mMainThread.getApplicationThread(), getBasePackageName(),
intent, intent.resolveTypeIfNeeded(getContentResolver()), mToken,
mEmbeddedID, requestCode, ActivityManager.START_FLAG_ONLY_IF_NEEDED,
null, options);
} catch (RemoteException e) {
// Empty
}
Instrumentation.checkStartActivityResult(result, intent);
if (requestCode >= 0) {
// If this start is requesting a result, we can avoid making
// the activity visible until the result is received. Setting
// this code during onCreate(Bundle savedInstanceState) or onResume() will keep the
// activity hidden during this time, to avoid flickering.
// This can only be done when a result is requested because
// that guarantees we will get information back when the
// activity is finished, no matter what happens to it.
mStartedActivity = true;
}
return result != ActivityManager.START_RETURN_INTENT_TO_CALLER;
}
throw new UnsupportedOperationException(
"startActivityIfNeeded can only be called from a top-level activity");
}
java类android.annotation.NonNull的实例源码
a.java 文件源码
项目:ProgressManager
阅读 22
收藏 0
点赞 0
评论 0
a.java 文件源码
项目:ProgressManager
阅读 19
收藏 0
点赞 0
评论 0
/**
* A special variation to launch an activity only if a new activity
* instance is needed to handle the given Intent. In other words, this is
* just like {@link #startActivityForResult(Intent, int)} except: if you are
* using the {@link Intent#FLAG_ACTIVITY_SINGLE_TOP} flag, or
* singleTask or singleTop
* {@link android.R.styleable#AndroidManifestActivity_launchMode launchMode},
* and the activity
* that handles <var>intent</var> is the same as your currently running
* activity, then a new instance is not needed. In this case, instead of
* the normal behavior of calling {@link #onNewIntent} this function will
* return and you can handle the Intent yourself.
*
* <p>This function can only be called from a top-level activity; if it is
* called from a child activity, a runtime exception will be thrown.
*
* @param intent The intent to start.
* @param requestCode If >= 0, this code will be returned in
* onActivityResult() when the activity exits, as described in
* {@link #startActivityForResult}.
* @param options Additional options for how the Activity should be started.
* See {@link android.content.Context#startActivity(Intent, Bundle)
* Context.startActivity(Intent, Bundle)} for more details.
*
* @return If a new activity was launched then true is returned; otherwise
* false is returned and you must handle the Intent yourself.
*
* @see #startActivity
* @see #startActivityForResult
*/
public boolean startActivityIfNeeded(@RequiresPermission @NonNull Intent intent,
int requestCode, @Nullable Bundle options) {
if (mParent == null) {
int result = ActivityManager.START_RETURN_INTENT_TO_CALLER;
try {
Uri referrer = onProvideReferrer();
if (referrer != null) {
intent.putExtra(Intent.EXTRA_REFERRER, referrer);
}
intent.migrateExtraStreamToClipData();
intent.prepareToLeaveProcess(this);
result = ActivityManagerNative.getDefault()
.startActivity(mMainThread.getApplicationThread(), getBasePackageName(),
intent, intent.resolveTypeIfNeeded(getContentResolver()), mToken,
mEmbeddedID, requestCode, ActivityManager.START_FLAG_ONLY_IF_NEEDED,
null, options);
} catch (RemoteException e) {
// Empty
}
Instrumentation.checkStartActivityResult(result, intent);
if (requestCode >= 0) {
// If this start is requesting a result, we can avoid making
// the activity visible until the result is received. Setting
// this code during onCreate(Bundle savedInstanceState) or onResume() will keep the
// activity hidden during this time, to avoid flickering.
// This can only be done when a result is requested because
// that guarantees we will get information back when the
// activity is finished, no matter what happens to it.
mStartedActivity = true;
}
return result != ActivityManager.START_RETURN_INTENT_TO_CALLER;
}
throw new UnsupportedOperationException(
"startActivityIfNeeded can only be called from a top-level activity");
}
a.java 文件源码
项目:ProgressManager
阅读 23
收藏 0
点赞 0
评论 0
/**
* A special variation to launch an activity only if a new activity
* instance is needed to handle the given Intent. In other words, this is
* just like {@link #startActivityForResult(Intent, int)} except: if you are
* using the {@link Intent#FLAG_ACTIVITY_SINGLE_TOP} flag, or
* singleTask or singleTop
* {@link android.R.styleable#AndroidManifestActivity_launchMode launchMode},
* and the activity
* that handles <var>intent</var> is the same as your currently running
* activity, then a new instance is not needed. In this case, instead of
* the normal behavior of calling {@link #onNewIntent} this function will
* return and you can handle the Intent yourself.
*
* <p>This function can only be called from a top-level activity; if it is
* called from a child activity, a runtime exception will be thrown.
*
* @param intent The intent to start.
* @param requestCode If >= 0, this code will be returned in
* onActivityResult() when the activity exits, as described in
* {@link #startActivityForResult}.
* @param options Additional options for how the Activity should be started.
* See {@link android.content.Context#startActivity(Intent, Bundle)
* Context.startActivity(Intent, Bundle)} for more details.
*
* @return If a new activity was launched then true is returned; otherwise
* false is returned and you must handle the Intent yourself.
*
* @see #startActivity
* @see #startActivityForResult
*/
public boolean startActivityIfNeeded(@RequiresPermission @NonNull Intent intent,
int requestCode, @Nullable Bundle options) {
if (mParent == null) {
int result = ActivityManager.START_RETURN_INTENT_TO_CALLER;
try {
Uri referrer = onProvideReferrer();
if (referrer != null) {
intent.putExtra(Intent.EXTRA_REFERRER, referrer);
}
intent.migrateExtraStreamToClipData();
intent.prepareToLeaveProcess(this);
result = ActivityManagerNative.getDefault()
.startActivity(mMainThread.getApplicationThread(), getBasePackageName(),
intent, intent.resolveTypeIfNeeded(getContentResolver()), mToken,
mEmbeddedID, requestCode, ActivityManager.START_FLAG_ONLY_IF_NEEDED,
null, options);
} catch (RemoteException e) {
// Empty
}
Instrumentation.checkStartActivityResult(result, intent);
if (requestCode >= 0) {
// If this start is requesting a result, we can avoid making
// the activity visible until the result is received. Setting
// this code during onCreate(Bundle savedInstanceState) or onResume() will keep the
// activity hidden during this time, to avoid flickering.
// This can only be done when a result is requested because
// that guarantees we will get information back when the
// activity is finished, no matter what happens to it.
mStartedActivity = true;
}
return result != ActivityManager.START_RETURN_INTENT_TO_CALLER;
}
throw new UnsupportedOperationException(
"startActivityIfNeeded can only be called from a top-level activity");
}
a.java 文件源码
项目:ProgressManager
阅读 22
收藏 0
点赞 0
评论 0
/**
* Returns class name for this activity with the package prefix removed.
* This is the default name used to read and write settings.
*
* @return The local class name.
*/
@NonNull
public String getLocalClassName() {
final String pkg = getPackageName();
final String cls = mComponent.getClassName();
int packageLen = pkg.length();
if (!cls.startsWith(pkg) || cls.length() <= packageLen
|| cls.charAt(packageLen) != '.') {
return cls;
}
return cls.substring(packageLen+1);
}
a.java 文件源码
项目:ProgressManager
阅读 21
收藏 0
点赞 0
评论 0
/**
* This is called when a child activity of this one calls its
* finishActivity().
*
* @param child The activity making the call.
* @param requestCode Request code that had been used to start the
* activity.
*/
public void finishActivityFromChild(@NonNull Activity child, int requestCode) {
try {
ActivityManagerNative.getDefault()
.finishSubActivity(mToken, child.mEmbeddedID, requestCode);
} catch (RemoteException e) {
// Empty
}
}
a.java 文件源码
项目:ProgressManager
阅读 20
收藏 0
点赞 0
评论 0
@Override
public Object getSystemService(@ServiceName @NonNull String name) {
if (getBaseContext() == null) {
throw new IllegalStateException(
"System services not available to Activities before onCreate()");
}
if (WINDOW_SERVICE.equals(name)) {
return mWindowManager;
} else if (SEARCH_SERVICE.equals(name)) {
ensureSearchManager();
return mSearchManager;
}
return super.getSystemService(name);
}
a.java 文件源码
项目:ProgressManager
阅读 26
收藏 0
点赞 0
评论 0
/**
* This is called when a child activity of this one calls its
* finishActivity().
*
* @param child The activity making the call.
* @param requestCode Request code that had been used to start the
* activity.
*/
public void finishActivityFromChild(@NonNull Activity child, int requestCode) {
try {
ActivityManagerNative.getDefault()
.finishSubActivity(mToken, child.mEmbeddedID, requestCode);
} catch (RemoteException e) {
// Empty
}
}
a.java 文件源码
项目:ProgressManager
阅读 21
收藏 0
点赞 0
评论 0
/**
* Create a new PendingIntent object which you can hand to others
* for them to use to send result data back to your
* {@link #onActivityResult} callback. The created object will be either
* one-shot (becoming invalid after a result is sent back) or multiple
* (allowing any number of results to be sent through it).
*
* @param requestCode Private request code for the sender that will be
* associated with the result data when it is returned. The sender can not
* modify this value, allowing you to identify incoming results.
* @param data Default data to supply in the result, which may be modified
* by the sender.
* @param flags May be {@link PendingIntent#FLAG_ONE_SHOT PendingIntent.FLAG_ONE_SHOT},
* {@link PendingIntent#FLAG_NO_CREATE PendingIntent.FLAG_NO_CREATE},
* {@link PendingIntent#FLAG_CANCEL_CURRENT PendingIntent.FLAG_CANCEL_CURRENT},
* {@link PendingIntent#FLAG_UPDATE_CURRENT PendingIntent.FLAG_UPDATE_CURRENT},
* or any of the flags as supported by
* {@link Intent#fillIn Intent.fillIn()} to control which unspecified parts
* of the intent that can be supplied when the actual send happens.
*
* @return Returns an existing or new PendingIntent matching the given
* parameters. May return null only if
* {@link PendingIntent#FLAG_NO_CREATE PendingIntent.FLAG_NO_CREATE} has been
* supplied.
*
* @see PendingIntent
*/
public PendingIntent createPendingResult(int requestCode, @NonNull Intent data,
@PendingIntent.Flags int flags) {
String packageName = getPackageName();
try {
data.prepareToLeaveProcess(this);
IIntentSender target =
ActivityManagerNative.getDefault().getIntentSender(
ActivityManager.INTENT_SENDER_ACTIVITY_RESULT, packageName,
mParent == null ? mToken : mParent.mToken,
mEmbeddedID, requestCode, new Intent[] { data }, null, flags, null,
UserHandle.myUserId());
return target != null ? new PendingIntent(target) : null;
} catch (RemoteException e) {
// Empty
}
return null;
}
a.java 文件源码
项目:ProgressManager
阅读 20
收藏 0
点赞 0
评论 0
/**
* This is called when a child activity of this one calls its
* finishActivity().
*
* @param child The activity making the call.
* @param requestCode Request code that had been used to start the
* activity.
*/
public void finishActivityFromChild(@NonNull Activity child, int requestCode) {
try {
ActivityManagerNative.getDefault()
.finishSubActivity(mToken, child.mEmbeddedID, requestCode);
} catch (RemoteException e) {
// Empty
}
}
a.java 文件源码
项目:ProgressManager
阅读 25
收藏 0
点赞 0
评论 0
/**
* Returns class name for this activity with the package prefix removed.
* This is the default name used to read and write settings.
*
* @return The local class name.
*/
@NonNull
public String getLocalClassName() {
final String pkg = getPackageName();
final String cls = mComponent.getClassName();
int packageLen = pkg.length();
if (!cls.startsWith(pkg) || cls.length() <= packageLen
|| cls.charAt(packageLen) != '.') {
return cls;
}
return cls.substring(packageLen+1);
}
a.java 文件源码
项目:ProgressManager
阅读 26
收藏 0
点赞 0
评论 0
@Override
public Object getSystemService(@ServiceName @NonNull String name) {
if (getBaseContext() == null) {
throw new IllegalStateException(
"System services not available to Activities before onCreate()");
}
if (WINDOW_SERVICE.equals(name)) {
return mWindowManager;
} else if (SEARCH_SERVICE.equals(name)) {
ensureSearchManager();
return mSearchManager;
}
return super.getSystemService(name);
}
a.java 文件源码
项目:ProgressManager
阅读 26
收藏 0
点赞 0
评论 0
/**
* Returns class name for this activity with the package prefix removed.
* This is the default name used to read and write settings.
*
* @return The local class name.
*/
@NonNull
public String getLocalClassName() {
final String pkg = getPackageName();
final String cls = mComponent.getClassName();
int packageLen = pkg.length();
if (!cls.startsWith(pkg) || cls.length() <= packageLen
|| cls.charAt(packageLen) != '.') {
return cls;
}
return cls.substring(packageLen+1);
}
a.java 文件源码
项目:ProgressManager
阅读 26
收藏 0
点赞 0
评论 0
/**
* This is called when a child activity of this one calls its
* finishActivity().
*
* @param child The activity making the call.
* @param requestCode Request code that had been used to start the
* activity.
*/
public void finishActivityFromChild(@NonNull Activity child, int requestCode) {
try {
ActivityManagerNative.getDefault()
.finishSubActivity(mToken, child.mEmbeddedID, requestCode);
} catch (RemoteException e) {
// Empty
}
}
a.java 文件源码
项目:ProgressManager
阅读 19
收藏 0
点赞 0
评论 0
/**
* Special version of starting an activity, for use when you are replacing
* other activity components. You can use this to hand the Intent off
* to the next Activity that can handle it. You typically call this in
* {@link #onCreate} with the Intent returned by {@link #getIntent}.
*
* @param intent The intent to dispatch to the next activity. For
* correct behavior, this must be the same as the Intent that started
* your own activity; the only changes you can make are to the extras
* inside of it.
* @param options Additional options for how the Activity should be started.
* See {@link android.content.Context#startActivity(Intent, Bundle)
* Context.startActivity(Intent, Bundle)} for more details.
*
* @return Returns a boolean indicating whether there was another Activity
* to start: true if there was a next activity to start, false if there
* wasn't. In general, if true is returned you will then want to call
* finish() on yourself.
*/
public boolean startNextMatchingActivity(@RequiresPermission @NonNull Intent intent,
@Nullable Bundle options) {
if (mParent == null) {
try {
intent.migrateExtraStreamToClipData();
intent.prepareToLeaveProcess(this);
return ActivityManagerNative.getDefault()
.startNextMatchingActivity(mToken, intent, options);
} catch (RemoteException e) {
// Empty
}
return false;
}
throw new UnsupportedOperationException(
"startNextMatchingActivity can only be called from a top-level activity");
}
a.java 文件源码
项目:ProgressManager
阅读 21
收藏 0
点赞 0
评论 0
@Override
public Object getSystemService(@ServiceName @NonNull String name) {
if (getBaseContext() == null) {
throw new IllegalStateException(
"System services not available to Activities before onCreate()");
}
if (WINDOW_SERVICE.equals(name)) {
return mWindowManager;
} else if (SEARCH_SERVICE.equals(name)) {
ensureSearchManager();
return mSearchManager;
}
return super.getSystemService(name);
}
a.java 文件源码
项目:ProgressManager
阅读 22
收藏 0
点赞 0
评论 0
/**
* A special variation to launch an activity only if a new activity
* instance is needed to handle the given Intent. In other words, this is
* just like {@link #startActivityForResult(Intent, int)} except: if you are
* using the {@link Intent#FLAG_ACTIVITY_SINGLE_TOP} flag, or
* singleTask or singleTop
* {@link android.R.styleable#AndroidManifestActivity_launchMode launchMode},
* and the activity
* that handles <var>intent</var> is the same as your currently running
* activity, then a new instance is not needed. In this case, instead of
* the normal behavior of calling {@link #onNewIntent} this function will
* return and you can handle the Intent yourself.
*
* <p>This function can only be called from a top-level activity; if it is
* called from a child activity, a runtime exception will be thrown.
*
* @param intent The intent to start.
* @param requestCode If >= 0, this code will be returned in
* onActivityResult() when the activity exits, as described in
* {@link #startActivityForResult}.
* @param options Additional options for how the Activity should be started.
* See {@link android.content.Context#startActivity(Intent, Bundle)
* Context.startActivity(Intent, Bundle)} for more details.
*
* @return If a new activity was launched then true is returned; otherwise
* false is returned and you must handle the Intent yourself.
*
* @see #startActivity
* @see #startActivityForResult
*/
public boolean startActivityIfNeeded(@RequiresPermission @NonNull Intent intent,
int requestCode, @Nullable Bundle options) {
if (mParent == null) {
int result = ActivityManager.START_RETURN_INTENT_TO_CALLER;
try {
Uri referrer = onProvideReferrer();
if (referrer != null) {
intent.putExtra(Intent.EXTRA_REFERRER, referrer);
}
intent.migrateExtraStreamToClipData();
intent.prepareToLeaveProcess(this);
result = ActivityManagerNative.getDefault()
.startActivity(mMainThread.getApplicationThread(), getBasePackageName(),
intent, intent.resolveTypeIfNeeded(getContentResolver()), mToken,
mEmbeddedID, requestCode, ActivityManager.START_FLAG_ONLY_IF_NEEDED,
null, options);
} catch (RemoteException e) {
// Empty
}
Instrumentation.checkStartActivityResult(result, intent);
if (requestCode >= 0) {
// If this start is requesting a result, we can avoid making
// the activity visible until the result is received. Setting
// this code during onCreate(Bundle savedInstanceState) or onResume() will keep the
// activity hidden during this time, to avoid flickering.
// This can only be done when a result is requested because
// that guarantees we will get information back when the
// activity is finished, no matter what happens to it.
mStartedActivity = true;
}
return result != ActivityManager.START_RETURN_INTENT_TO_CALLER;
}
throw new UnsupportedOperationException(
"startActivityIfNeeded can only be called from a top-level activity");
}
a.java 文件源码
项目:ProgressManager
阅读 26
收藏 0
点赞 0
评论 0
@Override
public Object getSystemService(@ServiceName @NonNull String name) {
if (getBaseContext() == null) {
throw new IllegalStateException(
"System services not available to Activities before onCreate()");
}
if (WINDOW_SERVICE.equals(name)) {
return mWindowManager;
} else if (SEARCH_SERVICE.equals(name)) {
ensureSearchManager();
return mSearchManager;
}
return super.getSystemService(name);
}
a.java 文件源码
项目:ProgressManager
阅读 26
收藏 0
点赞 0
评论 0
/**
* Special version of starting an activity, for use when you are replacing
* other activity components. You can use this to hand the Intent off
* to the next Activity that can handle it. You typically call this in
* {@link #onCreate} with the Intent returned by {@link #getIntent}.
*
* @param intent The intent to dispatch to the next activity. For
* correct behavior, this must be the same as the Intent that started
* your own activity; the only changes you can make are to the extras
* inside of it.
* @param options Additional options for how the Activity should be started.
* See {@link android.content.Context#startActivity(Intent, Bundle)
* Context.startActivity(Intent, Bundle)} for more details.
*
* @return Returns a boolean indicating whether there was another Activity
* to start: true if there was a next activity to start, false if there
* wasn't. In general, if true is returned you will then want to call
* finish() on yourself.
*/
public boolean startNextMatchingActivity(@RequiresPermission @NonNull Intent intent,
@Nullable Bundle options) {
if (mParent == null) {
try {
intent.migrateExtraStreamToClipData();
intent.prepareToLeaveProcess(this);
return ActivityManagerNative.getDefault()
.startNextMatchingActivity(mToken, intent, options);
} catch (RemoteException e) {
// Empty
}
return false;
}
throw new UnsupportedOperationException(
"startNextMatchingActivity can only be called from a top-level activity");
}
a.java 文件源码
项目:ProgressManager
阅读 20
收藏 0
点赞 0
评论 0
/**
* This is called when a child activity of this one calls its
* finishActivity().
*
* @param child The activity making the call.
* @param requestCode Request code that had been used to start the
* activity.
*/
public void finishActivityFromChild(@NonNull Activity child, int requestCode) {
try {
ActivityManagerNative.getDefault()
.finishSubActivity(mToken, child.mEmbeddedID, requestCode);
} catch (RemoteException e) {
// Empty
}
}
a.java 文件源码
项目:ProgressManager
阅读 19
收藏 0
点赞 0
评论 0
@Override
public Object getSystemService(@ServiceName @NonNull String name) {
if (getBaseContext() == null) {
throw new IllegalStateException(
"System services not available to Activities before onCreate()");
}
if (WINDOW_SERVICE.equals(name)) {
return mWindowManager;
} else if (SEARCH_SERVICE.equals(name)) {
ensureSearchManager();
return mSearchManager;
}
return super.getSystemService(name);
}
a.java 文件源码
项目:ProgressManager
阅读 21
收藏 0
点赞 0
评论 0
@Override
public Object getSystemService(@ServiceName @NonNull String name) {
if (getBaseContext() == null) {
throw new IllegalStateException(
"System services not available to Activities before onCreate()");
}
if (WINDOW_SERVICE.equals(name)) {
return mWindowManager;
} else if (SEARCH_SERVICE.equals(name)) {
ensureSearchManager();
return mSearchManager;
}
return super.getSystemService(name);
}
a.java 文件源码
项目:ProgressManager
阅读 20
收藏 0
点赞 0
评论 0
@Override
public Object getSystemService(@ServiceName @NonNull String name) {
if (getBaseContext() == null) {
throw new IllegalStateException(
"System services not available to Activities before onCreate()");
}
if (WINDOW_SERVICE.equals(name)) {
return mWindowManager;
} else if (SEARCH_SERVICE.equals(name)) {
ensureSearchManager();
return mSearchManager;
}
return super.getSystemService(name);
}
a.java 文件源码
项目:ProgressManager
阅读 30
收藏 0
点赞 0
评论 0
/**
* This is called when a child activity of this one calls its
* finishActivity().
*
* @param child The activity making the call.
* @param requestCode Request code that had been used to start the
* activity.
*/
public void finishActivityFromChild(@NonNull Activity child, int requestCode) {
try {
ActivityManagerNative.getDefault()
.finishSubActivity(mToken, child.mEmbeddedID, requestCode);
} catch (RemoteException e) {
// Empty
}
}
a.java 文件源码
项目:ProgressManager
阅读 22
收藏 0
点赞 0
评论 0
/**
* Special version of starting an activity, for use when you are replacing
* other activity components. You can use this to hand the Intent off
* to the next Activity that can handle it. You typically call this in
* {@link #onCreate} with the Intent returned by {@link #getIntent}.
*
* @param intent The intent to dispatch to the next activity. For
* correct behavior, this must be the same as the Intent that started
* your own activity; the only changes you can make are to the extras
* inside of it.
* @param options Additional options for how the Activity should be started.
* See {@link android.content.Context#startActivity(Intent, Bundle)
* Context.startActivity(Intent, Bundle)} for more details.
*
* @return Returns a boolean indicating whether there was another Activity
* to start: true if there was a next activity to start, false if there
* wasn't. In general, if true is returned you will then want to call
* finish() on yourself.
*/
public boolean startNextMatchingActivity(@RequiresPermission @NonNull Intent intent,
@Nullable Bundle options) {
if (mParent == null) {
try {
intent.migrateExtraStreamToClipData();
intent.prepareToLeaveProcess(this);
return ActivityManagerNative.getDefault()
.startNextMatchingActivity(mToken, intent, options);
} catch (RemoteException e) {
// Empty
}
return false;
}
throw new UnsupportedOperationException(
"startNextMatchingActivity can only be called from a top-level activity");
}
a.java 文件源码
项目:ProgressManager
阅读 89
收藏 0
点赞 0
评论 0
/**
* Special version of starting an activity, for use when you are replacing
* other activity components. You can use this to hand the Intent off
* to the next Activity that can handle it. You typically call this in
* {@link #onCreate} with the Intent returned by {@link #getIntent}.
*
* @param intent The intent to dispatch to the next activity. For
* correct behavior, this must be the same as the Intent that started
* your own activity; the only changes you can make are to the extras
* inside of it.
* @param options Additional options for how the Activity should be started.
* See {@link android.content.Context#startActivity(Intent, Bundle)
* Context.startActivity(Intent, Bundle)} for more details.
*
* @return Returns a boolean indicating whether there was another Activity
* to start: true if there was a next activity to start, false if there
* wasn't. In general, if true is returned you will then want to call
* finish() on yourself.
*/
public boolean startNextMatchingActivity(@RequiresPermission @NonNull Intent intent,
@Nullable Bundle options) {
if (mParent == null) {
try {
intent.migrateExtraStreamToClipData();
intent.prepareToLeaveProcess(this);
return ActivityManagerNative.getDefault()
.startNextMatchingActivity(mToken, intent, options);
} catch (RemoteException e) {
// Empty
}
return false;
}
throw new UnsupportedOperationException(
"startNextMatchingActivity can only be called from a top-level activity");
}
a.java 文件源码
项目:ProgressManager
阅读 18
收藏 0
点赞 0
评论 0
@Override
public Object getSystemService(@ServiceName @NonNull String name) {
if (getBaseContext() == null) {
throw new IllegalStateException(
"System services not available to Activities before onCreate()");
}
if (WINDOW_SERVICE.equals(name)) {
return mWindowManager;
} else if (SEARCH_SERVICE.equals(name)) {
ensureSearchManager();
return mSearchManager;
}
return super.getSystemService(name);
}
a.java 文件源码
项目:ProgressManager
阅读 25
收藏 0
点赞 0
评论 0
/**
* This is called when a child activity of this one calls its
* finishActivity().
*
* @param child The activity making the call.
* @param requestCode Request code that had been used to start the
* activity.
*/
public void finishActivityFromChild(@NonNull Activity child, int requestCode) {
try {
ActivityManagerNative.getDefault()
.finishSubActivity(mToken, child.mEmbeddedID, requestCode);
} catch (RemoteException e) {
// Empty
}
}
a.java 文件源码
项目:ProgressManager
阅读 21
收藏 0
点赞 0
评论 0
/**
* Special version of starting an activity, for use when you are replacing
* other activity components. You can use this to hand the Intent off
* to the next Activity that can handle it. You typically call this in
* {@link #onCreate} with the Intent returned by {@link #getIntent}.
*
* @param intent The intent to dispatch to the next activity. For
* correct behavior, this must be the same as the Intent that started
* your own activity; the only changes you can make are to the extras
* inside of it.
* @param options Additional options for how the Activity should be started.
* See {@link android.content.Context#startActivity(Intent, Bundle)
* Context.startActivity(Intent, Bundle)} for more details.
*
* @return Returns a boolean indicating whether there was another Activity
* to start: true if there was a next activity to start, false if there
* wasn't. In general, if true is returned you will then want to call
* finish() on yourself.
*/
public boolean startNextMatchingActivity(@RequiresPermission @NonNull Intent intent,
@Nullable Bundle options) {
if (mParent == null) {
try {
intent.migrateExtraStreamToClipData();
intent.prepareToLeaveProcess(this);
return ActivityManagerNative.getDefault()
.startNextMatchingActivity(mToken, intent, options);
} catch (RemoteException e) {
// Empty
}
return false;
}
throw new UnsupportedOperationException(
"startNextMatchingActivity can only be called from a top-level activity");
}
a.java 文件源码
项目:ProgressManager
阅读 21
收藏 0
点赞 0
评论 0
/**
* Special version of starting an activity, for use when you are replacing
* other activity components. You can use this to hand the Intent off
* to the next Activity that can handle it. You typically call this in
* {@link #onCreate} with the Intent returned by {@link #getIntent}.
*
* @param intent The intent to dispatch to the next activity. For
* correct behavior, this must be the same as the Intent that started
* your own activity; the only changes you can make are to the extras
* inside of it.
* @param options Additional options for how the Activity should be started.
* See {@link android.content.Context#startActivity(Intent, Bundle)
* Context.startActivity(Intent, Bundle)} for more details.
*
* @return Returns a boolean indicating whether there was another Activity
* to start: true if there was a next activity to start, false if there
* wasn't. In general, if true is returned you will then want to call
* finish() on yourself.
*/
public boolean startNextMatchingActivity(@RequiresPermission @NonNull Intent intent,
@Nullable Bundle options) {
if (mParent == null) {
try {
intent.migrateExtraStreamToClipData();
intent.prepareToLeaveProcess(this);
return ActivityManagerNative.getDefault()
.startNextMatchingActivity(mToken, intent, options);
} catch (RemoteException e) {
// Empty
}
return false;
}
throw new UnsupportedOperationException(
"startNextMatchingActivity can only be called from a top-level activity");
}
a.java 文件源码
项目:ProgressManager
阅读 24
收藏 0
点赞 0
评论 0
/**
* Convenience for calling
* {@link android.view.Window#getLayoutInflater}.
*/
@NonNull
public LayoutInflater getLayoutInflater() {
return getWindow().getLayoutInflater();
}