本文整理汇总了Java中android.content.Intent.getFlags方法的典型用法代码示例。如果您正苦于以下问题:Java Intent.getFlags方法的具体用法?Java Intent.getFlags怎么用?Java Intent.getFlags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.Intent
的用法示例。
在下文中一共展示了Intent.getFlags方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveIntent
import android.content.Intent; //导入方法依赖的package包/类
private void resolveIntent(Intent data) {
this.setIntent(data);
if ((data.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0) {
return;
}
if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(data.getAction())) {
mLastNfcTag = data.getParcelableExtra(NfcAdapter.EXTRA_TAG);
long now = new Date().getTime();
if (mContinuousSensorReadingFlag) {
startContinuousSensorReadingTimer();
} else if (now - mLastScanTime > 5000) {
DataPlotFragment dataPlotFragment = (DataPlotFragment)
mSectionsPagerAdapter.getRegisteredFragment(R.integer.viewpager_page_show_scan);
if (dataPlotFragment != null) {
dataPlotFragment.clearScanData();
}
new NfcVReaderTask(this).execute(mLastNfcTag);
}
}
}
示例2: queryIntentFromList
import android.content.Intent; //导入方法依赖的package包/类
public List<R> queryIntentFromList(Intent intent, String resolvedType,
boolean defaultOnly, ArrayList<F[]> listCut) {
ArrayList<R> resultList = new ArrayList<R>();
final boolean debug = localLOGV ||
((intent.getFlags() & Intent.FLAG_DEBUG_LOG_RESOLUTION) != 0);
FastImmutableArraySet<String> categories = getFastIntentCategories(intent);
final String scheme = intent.getScheme();
int N = listCut.size();
for (int i = 0; i < N; ++i) {
buildResolveList(intent, categories, debug, defaultOnly,
resolvedType, scheme, listCut.get(i), resultList);
}
sortResults(resultList);
return resultList;
}
示例3: handleAppDeepLink
import android.content.Intent; //导入方法依赖的package包/类
/**
* Method to handle deeplink parameters received via intent
*/
private void handleAppDeepLink() {
appDeepLink = new AppDeepLink(DeepLinkUtil.DEFAULT);
// Extract deeplink params from the received intent
Intent intent = getIntent();
if (intent != null && !HTTextUtils.isEmpty(intent.getDataString())) {
Log.d(TAG, "deeplink " + intent.getDataString());
int flags = intent.getFlags();
if ((flags & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0) {
return;
}
appDeepLink = DeepLinkUtil.prepareAppDeepLink(this, intent.getData());
}
}
示例4: resolveService
import android.content.Intent; //导入方法依赖的package包/类
@Override public ResolveInfo resolveService(final Intent intent, final int flags) {
final int original_intent_flags = intent.getFlags();
// Intent flags could only filter background receivers, we have to deal with services by ourselves.
return mCondom.proceed(OutboundType.QUERY_SERVICES, intent, null, new CondomCore.WrappedValueProcedure<ResolveInfo>() { @Override public ResolveInfo proceed() {
if (! mCondom.mExcludeBackgroundServices && mCondom.mOutboundJudge == null)
return CondomPackageManager.super.resolveService(intent, flags); // Shortcut for pass-through
final List<ResolveInfo> candidates = CondomPackageManager.super.queryIntentServices(intent, flags);
final Intent original_intent = intent.setFlags(original_intent_flags); // Restore the intent flags early before getFirstMatch().
return mCondom.filterCandidates(OutboundType.QUERY_SERVICES, original_intent, candidates, TAG, false);
}});
}
示例5: queryIntentFromList
import android.content.Intent; //导入方法依赖的package包/类
public List<R> queryIntentFromList(Intent intent, String resolvedType, boolean defaultOnly,
ArrayList<F[]> listCut) {
ArrayList<R> resultList = new ArrayList<R>();
final boolean debug = localLOGV || ((intent.getFlags() & Intent.FLAG_DEBUG_LOG_RESOLUTION) != 0);
FastImmutableArraySet<String> categories = getFastIntentCategories(intent);
final String scheme = intent.getScheme();
int N = listCut.size();
for (int i = 0; i < N; ++i) {
buildResolveList(intent, categories, debug, defaultOnly, resolvedType, scheme, listCut.get(i), resultList);
}
sortResults(resultList);
return resultList;
}
示例6: onNewIntent
import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if (System.currentTimeMillis() - mPauseTime < 1000 && Intent.ACTION_MAIN.equals(intent.getAction())) {
final boolean alreadyOnHome =
((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT)
!= Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
Log.d("LaunchTime", " new intent " + alreadyOnHome);
if (alreadyOnHome && !mChildLock) {
// If we are on home screen, reset most things and go to top category.
mCategoriesScroller.postDelayed(new Runnable() {
@Override
public void run() {
try {
mSearchBox.setSearchText("");
mCategoriesScroller.smoothScrollTo(0, 0);
showButtonBar(false, true);
mIconSheetScroller.smoothScrollTo(0, 0);
switchCategory(getTopCategory());
mQuickRow.scrollToStart();
mIconSheetScroller.smoothScrollTo(0, 0);
mCategoriesScroller.smoothScrollTo(0, 0);
} catch (Exception e) {
Log.e(TAG, e.getMessage(), e);
}
}
}, 200);
}
}
}
示例7: ensureUriPermission
import android.content.Intent; //导入方法依赖的package包/类
@SuppressWarnings("ResourceType")
@TargetApi(Build.VERSION_CODES.KITKAT)
public static Uri ensureUriPermission(Context context, Intent intent) {
Uri uri = intent.getData();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
final int takeFlags = intent.getFlags() & Intent.FLAG_GRANT_READ_URI_PERMISSION;
context.getContentResolver().takePersistableUriPermission(uri, takeFlags);
}
return uri;
}
示例8: createCustomTabActivityIntent
import android.content.Intent; //导入方法依赖的package包/类
/**
* Creates an Intent that can be used to launch a {@link CustomTabActivity}.
*/
public static Intent createCustomTabActivityIntent(
Context context, Intent intent, boolean addHerbExtras) {
// Use the copy constructor to carry over the myriad of extras.
Uri uri = Uri.parse(IntentHandler.getUrlFromIntent(intent));
Intent newIntent = new Intent(intent);
newIntent.setAction(Intent.ACTION_VIEW);
newIntent.setClassName(context, CustomTabActivity.class.getName());
newIntent.setData(uri);
// If a CCT intent triggers First Run, then NEW_TASK will be automatically applied. As
// part of that, it will inherit the EXCLUDE_FROM_RECENTS bit from ChromeLauncherActivity,
// so explicitly remove it to ensure the CCT does not get lost in recents.
if ((newIntent.getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK) != 0
|| (newIntent.getFlags() & Intent.FLAG_ACTIVITY_NEW_DOCUMENT) != 0) {
newIntent.setFlags(
newIntent.getFlags() & ~Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
}
if (addHerbExtras) {
// TODO(tedchoc|mariakhomenko): Specifically not marking the intent is from Chrome via
// IntentHandler.addTrustedIntentExtras as it breaks the
// redirect logic for triggering instant apps. See if
// this is better addressed in TabRedirectHandler long
// term.
newIntent.putExtra(CustomTabIntentDataProvider.EXTRA_IS_OPENED_BY_CHROME, true);
} else {
IntentUtils.safeRemoveExtra(
intent, CustomTabIntentDataProvider.EXTRA_IS_OPENED_BY_CHROME);
}
if (addHerbExtras) updateHerbIntent(context, newIntent);
return newIntent;
}
示例9: extract
import android.content.Intent; //导入方法依赖的package包/类
static HashSet<String> extract(@NonNull Intent intent) {
final int flags = intent.getFlags();
HashSet<String> flagsStrings = new HashSet<>();
for (int i = 0; i < FLAGS.size(); i++) {
int key = FLAGS.keyAt(i);
String value = FLAGS.valueAt(i);
if ((flags & key) != 0) {
flagsStrings.add(value);
}
}
return flagsStrings;
}
示例10: onNewIntent
import android.content.Intent; //导入方法依赖的package包/类
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if ((Intent.FLAG_ACTIVITY_CLEAR_TOP & intent.getFlags()) != 0 ){
finish();
}
}
示例11: onReceive
import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
if (mApp.isBooting()) {
return;
}
if ((intent.getFlags() & FLAG_RECEIVER_REGISTERED_ONLY) != 0 || isInitialStickyBroadcast()) {
return;
}
PendingResult result = goAsync();
synchronized (mAMS) {
if (!mAMS.handleStaticBroadcast(appId, info, intent, new PendingResultData(result))) {
result.finish();
}
}
}
示例12: queryIntentServices
import android.content.Intent; //导入方法依赖的package包/类
@Override public List<ResolveInfo> queryIntentServices(final Intent intent, final int flags) {
final int original_intent_flags = intent.getFlags();
return mCondom.proceedQuery(OutboundType.QUERY_SERVICES, intent, new CondomCore.WrappedValueProcedure<List<ResolveInfo>>() {
@Override public List<ResolveInfo> proceed() {
final List<ResolveInfo> result = CondomPackageManager.super.queryIntentServices(intent, flags);
mCondom.filterCandidates(OutboundType.QUERY_SERVICES, intent.setFlags(original_intent_flags), result, TAG, true);
return result;
}
}, CondomCore.SERVICE_PACKAGE_GETTER);
}
示例13: resolveService
import android.content.Intent; //导入方法依赖的package包/类
@Override public ResolveInfo resolveService(final Intent intent, final int flags) {
final int original_intent_flags = intent.getFlags();
// Intent flags could only filter background receivers, we have to deal with services by ourselves.
return mCondom.proceed(OutboundType.QUERY_SERVICES, intent, null, new CondomCore.WrappedValueProcedure<ResolveInfo>() {
@Override public ResolveInfo proceed() {
if (! mCondom.mExcludeBackgroundServices && mCondom.mOutboundJudge == null)
return CondomPackageManager.super.resolveService(intent, flags); // Shortcut for pass-through
final List<ResolveInfo> candidates = CondomPackageManager.super.queryIntentServices(intent, flags);
final Intent original_intent = intent.setFlags(original_intent_flags); // Restore the intent flags early before getFirstMatch().
return mCondom.filterCandidates(OutboundType.QUERY_SERVICES, original_intent, candidates, TAG, false);
}
});
}
示例14: onReceive
import android.content.Intent; //导入方法依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
if (mApp.isBooting()) {
return;
}
if ((intent.getFlags() & FLAG_RECEIVER_REGISTERED_ONLY) != 0 || isInitialStickyBroadcast()) {
return;
}
PendingResult result = goAsync();
if (!mAMS.handleStaticBroadcast(appId, info, intent, new PendingResultData(result))) {
result.finish();
}
}
示例15: queryIntentServices
import android.content.Intent; //导入方法依赖的package包/类
@Override public List<ResolveInfo> queryIntentServices(final Intent intent, final int flags) {
final int original_intent_flags = intent.getFlags();
return mCondom.proceedQuery(OutboundType.QUERY_SERVICES, intent, new CondomCore.WrappedValueProcedure<List<ResolveInfo>>() { @Override public List<ResolveInfo> proceed() {
final List<ResolveInfo> result = CondomPackageManager.super.queryIntentServices(intent, flags);
mCondom.filterCandidates(OutboundType.QUERY_SERVICES, intent.setFlags(original_intent_flags), result, TAG, true);
return result;
}});
}