diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index d7bec39043c58dbd6d9bfb115696b99e91074ddf..53fdf474ca55f0a1ab36a3bd64554e974e698100 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -18,6 +18,7 @@ package android.app; import static java.lang.Character.MIN_VALUE; +import android.view.Gravity; import android.annotation.CallSuper; import android.annotation.DrawableRes; import android.annotation.IdRes; @@ -838,6 +839,47 @@ public class Activity extends ContextThemeWrapper private boolean mHasCurrentPermissionsRequest; private boolean mEatKeyUpEvent; + private HashMap notPayList = new HashMap () { + { + // QQ + put("ComponentInfo{com.tencent.mobileqq/com.tencent.mobileqq.activity.qwallet.SendHbActivity}", 0); + put("ComponentInfo{com.tencent.mobileqq/com.tencent.mobileqq.activity.qwallet.TransactionActivity}", 0); + put("ComponentInfo{com.tencent.mobileqq/cooperation.qwallet.plugin.QWalletPluginProxyActivity}", 0); + // weixin + put("ComponentInfo{com.tencent.mm/com.tencent.mm.plugin.luckymoney.ui.LuckyMoneyPrepareUI}", 0); + put("ComponentInfo{com.tencent.mm/com.tencent.mm.plugin.remittance.ui.RemittanceUI}", 0); + put("ComponentInfo{com.tencent.mm/com.tencent.mm.plugin.mall.ui.MallIndexUI}", 0); + put("ComponentInfo{com.tencent.mm/com.tencent.mm.plugin.wallet_core.ui.WalletCheckPwdUI}", 0); + // taobao + put("ComponentInfo{com.taobao.taobao/com.taobao.android.purchase.TBPurchaseActivity}", 0); + // zhihu + put("ComponentInfo{com.zhihu.android/com.zhihu.android.premium.VipHostActivity}", 0); + // youdao + put("ComponentInfo{com.youdao.dict/com.youdao.dict.activity.vipcenter.VipCenterDBActivity}", 0); + // ditiepaoku + put("ComponentInfo{com.kiloo.subwaysurf/com.ms.sdk.plugin.payment.ledou.alipay.h5.H5PayActivity}", 0); + put("ComponentInfo{com.tencent.mm/com.tencent.mm.plugin.wallet.pay.ui.WalletPayUI}", 0); + put("ComponentInfo{com.tencent.mm/com.tencent.mm.plugin.wallet_index.ui.OrderHandlerUI}", 0); + // jinritoutiao + put("ComponentInfo{com.ss.android.article.news/com.ss.android.caijing.stock.portal.PortalActivity}", 0); + // qiyeweixin + put("ComponentInfo{com.tencent.wework/com.tencent.wework.enterprise.redenvelopes.controller.RedEnvelopeSenderWithCoverActi vity}", 0); + // dingding + put("ComponentInfo{com.alibaba.android.rimet/com.alibaba.android.dingtalk.redpackets.activities.SendActivity}", 0); + put("ComponentInfo{com.alibaba.android.rimet/com.alibaba.android.dingtalk.redpackets.activities.WalletActivity}" , 0); + // tengxunshipin + put("ComponentInfo{com.tencent.qqlive/com.tencent.qqlive.ona.browser.HollywoodH5Activity}", 0); + // meituan + put("ComponentInfo{com.sankuai.meituan/com.sankuai.waimai.business.knb.TakeoutKNBWebActivity}", 0); + // tonghuashun + put("ComponentInfo{com.hexin.plat.android/com.hexin.plat.android.IFundTransparentActivityProxy}", 0); + // douban + put("ComponentInfo{com.douban.frodo/com.douban.frodo.fangorns.pay.PaymentActivity}", 0); + // douyin + put("ComponentInfo{com.ss.android.ugc.aweme/com.ss.android.ugc.aweme.wallet.ui.WalletActivity}", 0); + } + }; + private static native String getDlWarning(); /** Return the intent that started this activity. */ @@ -4221,6 +4263,29 @@ public class Activity extends ContextThemeWrapper */ public void startActivityForResult(@RequiresPermission Intent intent, int requestCode, @Nullable Bundle options) { + if (intent == null) { + return; + } + String nIntent = intent.toString(); + boolean isPay = false; + if (intent.getComponent() != null) { + String nComponent = intent.getComponent().toString(); + if (notPayList.containsKey(nComponent)) { + isPay = true; + } + } else { + if (nIntent.indexOf("{ act=android.intent.action.VIEW dat=meituanpayment://conchpay/launch", 0) > 0) { + isPay = true; + } else if (nIntent.indexOf("https://npay.meituan.com/resource/conch-hybrid", 0) > 0) { + isPay = true; + } + } + if (isPay) { + Toast toast = Toast.makeText(this, "暂不支持支付功能", Toast.LENGTH_LONG); + toast.setGravity(Gravity.CENTER, 0, 0); + toast.show(); + return; + } if (mParent == null) { options = transferSpringboardActivityOptions(options); Instrumentation.ActivityResult ar = @@ -4516,6 +4581,29 @@ public class Activity extends ContextThemeWrapper */ @Override public void startActivity(Intent intent, @Nullable Bundle options) { + boolean isPay = false; + if (intent == null) { + return; + } + if (intent.getComponent() != null) { + String nComponent = intent.getComponent().toString(); + if (nComponent.indexOf("com.alipay.sdk.app.H5PayActivity", 0) > 0) { + isPay = true; + } else if (notPayList.containsKey(nComponent)) { + isPay = true; + } + } else { + String nIntent = intent.toString(); + if (nIntent.indexOf("quickpass/qrcode?entry=homenav", 0) > 0) { + isPay = true; + } + } + if (isPay) { + Toast toast = Toast.makeText(this, "暂不支持支付功能", Toast.LENGTH_LONG); + toast.setGravity(Gravity.CENTER, 0, 0); + toast.show(); + return; + } if (options != null) { startActivityForResult(intent, -1, options); } else { diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index 8d3db647284a13104658887e093de51154b18553..2d08868c5500464d8532f1bc5376a060dd33cb0f 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -16,6 +16,9 @@ package android.app; +import android.view.Gravity; +import java.util.HashMap; +import android.widget.Toast; import android.annotation.NonNull; import android.annotation.Nullable; import android.content.BroadcastReceiver; @@ -172,6 +175,13 @@ class ContextImpl extends Context { private final Object mSync = new Object(); + private HashMap notPayList = new HashMap () { + { + put("ComponentInfo{com.taobao.taobao/com.taobao.tao.alipay.cashdesk.CashDeskActivity}", 0); + put("ComponentInfo{com.taobao.taobao/com.alipay.mobile.verifyidentity.module.password.pay.ui.PayPwdDialogActivity}", 0); + } + }; + @GuardedBy("mSync") private File mDatabasesDir; @GuardedBy("mSync") @@ -788,6 +798,19 @@ class ContextImpl extends Context { + " context requires the FLAG_ACTIVITY_NEW_TASK flag." + " Is this really what you want?"); } + if (intent == null) { + return; + } + String nIntent = intent.toString(); + if (intent.getComponent() != null) { + String nComponent = intent.getComponent().toString(); + if (notPayList.containsKey(nComponent)) { + Toast toast = Toast.makeText(this, "暂不支持支付功能", Toast.LENGTH_LONG); + toast.setGravity(Gravity.CENTER, 0, 0); + toast.show(); + return; + } + } mMainThread.getInstrumentation().execStartActivity( getOuterContext(), mMainThread.getApplicationThread(), null, (Activity) null, intent, -1, options); diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index ee3253b2200f8677e3c891e35957ddedc3f245a9..fcfd5491d22fa4740bdec11286e9addb21634340 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -643,49 +643,6 @@ public final class ActivityManagerService extends ActivityManagerNative boolean mDoingSetFocusedActivity; - private HashMap notPayList = new HashMap () { - { - //QQ - put("ComponentInfo{com.tencent.mobileqq/com.tencent.mobileqq.activity.qwallet.SendHbActivity}", 0); - put("ComponentInfo{com.tencent.mobileqq/com.tencent.mobileqq.activity.qwallet.TransactionActivity}", 0); - put("ComponentInfo{com.tencent.mobileqq/cooperation.qwallet.plugin.QWalletPluginProxyActivity}", 0); - //weixin - put("ComponentInfo{com.tencent.mm/com.tencent.mm.plugin.luckymoney.ui.LuckyMoneyPrepareUI}", 0); - put("ComponentInfo{com.tencent.mm/com.tencent.mm.plugin.remittance.ui.RemittanceUI}", 0); - put("ComponentInfo{com.tencent.mm/com.tencent.mm.plugin.mall.ui.MallIndexUI}", 0); - //taobao - put("ComponentInfo{com.taobao.taobao/com.taobao.android.purchase.TBPurchaseActivity}", 0); - put("ComponentInfo{com.taobao.taobao/com.alipay.mobile.verifyidentity.module.password.pay.ui.PayPwdDialogActivity}", 0); - //zhihu - put("ComponentInfo{com.zhihu.android/com.zhihu.android.premium.VipHostActivity}", 0); - put("ComponentInfo{com.zhihu.android/com.alipay.sdk.app.H5PayActivity}", 0); - //youdao - put("ComponentInfo{com.youdao.dict/com.youdao.dict.activity.vipcenter.VipCenterDBActivity}", 0); - //ditiepaoku - put("ComponentInfo{com.kiloo.subwaysurf/com.ms.sdk.plugin.payment.ledou.alipay.h5.H5PayActivity}", 0); - put("ComponentInfo{com.tencent.mm/com.tencent.mm.plugin.wallet.pay.ui.WalletPayUI}", 0); - put("ComponentInfo{com.tencent.mm/com.tencent.mm.plugin.wallet_index.ui.OrderHandlerUI}", 0); - //jinritoutiao - put("ComponentInfo{com.ss.android.article.news/com.ss.android.caijing.stock.portal.PortalActivity}", 0); - //qiyeweixin - put("ComponentInfo{com.tencent.wework/com.tencent.wework.enterprise.redenvelopes.controller.RedEnvelopeSenderWithCoverActivity}", 0); - //dingding - put("ComponentInfo{com.alibaba.android.rimet/com.alibaba.android.dingtalk.redpackets.activities.SendActivity}", 0); - put("ComponentInfo{com.alibaba.android.rimet/com.alibaba.android.dingtalk.redpackets.activities.WalletActivity}", 0); - //tengxunshipin - put("ComponentInfo{com.tencent.qqlive/com.tencent.qqlive.ona.browser.HollywoodH5Activity}", 0); - //meituan - put("ComponentInfo{com.sankuai.meituan/com.sankuai.waimai.business.knb.TakeoutKNBWebActivity}", 0); - //tonghuashun - put("ComponentInfo{com.hexin.plat.android/com.hexin.plat.android.IFundTransparentActivityProxy}", 0); - //douban - put("ComponentInfo{com.douban.frodo/com.douban.frodo.fangorns.pay.PaymentActivity}", 0); - //douyin - put("ComponentInfo{com.ss.android.ugc.aweme/com.ss.android.ugc.aweme.wallet.ui.WalletActivity}", 0); - } - }; - - public boolean canShowErrorDialogs() { return mShowDialogs && !mSleeping && !mShuttingDown && mLockScreenShown != LOCK_SCREEN_SHOWN; @@ -4379,25 +4336,6 @@ public final class ActivityManagerService extends ActivityManagerNative public final int startActivity(IApplicationThread caller, String callingPackage, Intent intent, String resolvedType, IBinder resultTo, String resultWho, int requestCode, int startFlags, ProfilerInfo profilerInfo, Bundle bOptions) { - if (intent.getComponent() != null) { - String nComponent = intent.getComponent().toString(); - if (nComponent.indexOf("com.alipay.sdk.app.H5PayActivity", 0) > 0) { - return 0; - } - if (notPayList.containsKey(nComponent)) { - return 0; - } - } else { - String nIntent = intent.toString(); - if(nIntent.indexOf("{ act=android.intent.action.VIEW dat=meituanpayment://conchpay/launch", 0) > 0) { - return 0; - } else if (nIntent.indexOf("quickpass/qrcode?entry=homenav", 0) > 0) { - return 0; - } else if (nIntent.indexOf("https://npay.meituan.com/resource/conch-hybrid", 0) > 0) { - return 0; - } - } - return startActivityAsUser(caller, callingPackage, intent, resolvedType, resultTo, resultWho, requestCode, startFlags, profilerInfo, bOptions, UserHandle.getCallingUserId());