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;
}
...
}