Android Dialog弹窗过滤

Android Dialog弹窗过滤

N : frameworks/base/core/java/android/app/AlertDialog.java

public Builder setTitle(CharSequence title) {
    P.mTitle = title;
+    String pkg = P.mContext.getPackageName();
+    //String titlee = title.toString();
+    android.util.Log.e("dhyxxx", "wdong11 setTitle title is "+title+" package is "+pkg);
+    if(!TextUtils.isEmpty(pkg) && pkg.equals("com.google.android.youtube") && !TextUtils.isEmpty(title) && title.toString().contains("Google Play")) {
+        isYouTbDialog = true;
+    } else {
+        isYouTbDialog = false;
+    }
    return this;
}


public Builder setMessage(CharSequence message) {
    P.mMessage = message;
+   String strMessage = (String)message;
+   android.util.Log.e("dhyxxx", "xxxxx message =="+message);//dhy
+	if(message!=NULL){
+       if(strMessage.contains("Unknown issue with Google Play services")){
+          android.util.Log.e("dhyxxx", "1111");//dhy
+          isGooglePlayServices = true;
+       }
+   }
    return this;
}

frameworks/base/core/java/android/app/Dialog.java

+   protected static volatile boolean isYouTbDialog = false;
+   protected static volatile boolean isGooglePlayServices = false;
	...
	public void show() {
		if (DBG) {
            Log.d(TAG, "show");
        }
        
+		if(mContext != null) {
+		   String pkg = mContext.getPackageName();
+		   Log.d(TAG, "wdong1 show pkg is "+pkg);
+		   if(!TextUtils.isEmpty(pkg) && pkg.equals("com.google.android.youtube") && isYouTbDialog) {
+			   Log.d(TAG, "wdong1 show this is youtube update dialog! return..");
+			   return ;
+		   }
+	   }
	   
	  
+	   if(mContext != null) {
+		   String pkg = mContext.getPackageName();
+		   Log.d(TAG, "wdong1 show pkg is "+pkg);
+		   if(isGooglePlayServices) {
+			   Log.d("dhyxxx", "show this is GooglePlayServices update dialog! return..");
+			   return ;
+		   }
+	   }

	   if (mShowing) {
            if (mDecor != null) {
                if (mWindow.hasFeature(Window.FEATURE_ACTION_BAR)) {
                    mWindow.invalidatePanelMenu(Window.FEATURE_ACTION_BAR);
                }
                mDecor.setVisibility(View.VISIBLE);
            }
            return;
        }
	   ...
	}
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值