android4.4 安装微信7.0.6版本底部显示黑色的问题
找到画布高度设置背景
diff --git a/frameworks/base/core/java/android/view/View.java b/frameworks/base/core/java/android/view/View.java
index b120b86..1bac567 100644
--- a/frameworks/base/core/java/android/view/View.java
+++ b/frameworks/base/core/java/android/view/View.java
@@ -100,6 +100,9 @@ import java.util.Locale;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicInteger;
+import android.app.ActivityManager;
+import android.app.ActivityManager.RunningTaskInfo;
+import java.util.List;
/**
*
* This class represents the basic building block for user interface components. A View
@@ -14439,7 +14442,30 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
return more;
}
-
+
+//add by wuyu start
+ private String getTopActivityClassName() {
+ String className = null;
+ ActivityManager mActivityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
+ Listlist = mActivityManager.getRunningTasks(1);
+ if (!list.isEmpty() && list.get(0) != null && list.get(0).topActivity != null) {
+ className = list.get(0).topActivity.getClassName();
+Log.d("wuyu","className = " + className);
+ }
+ return className;
+ }
+
+private String getTopActivityPackageName() {
+String packageName = null;
+ ActivityManager mActivityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
+ Listlist = mActivityManager.getRunningTasks(1);
+ if (!list.isEmpty() && list.get(0) != null && list.get(0).topActivity != null) {
+packageName = list.get(0).topActivity.getPackageName();
+Log.d("wuyu","packageName = " + packageName);
+ }
+ return packageName;
+ }
+//add by wuyu end
/**
* Manually render this view (and all of its children) to the given Canvas.
* The view must have already done a full layout before this function is
@@ -14454,7 +14480,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
canvas.clipRect(mClipBounds);
}
final int privateFlags = mPrivateFlags;
- final boolean dirtyOpaque = (privateFlags & PFLAG_DIRTY_MASK) == PFLAG_DIRTY_OPAQUE &&
+ boolean dirtyOpaque = (privateFlags & PFLAG_DIRTY_MASK) == PFLAG_DIRTY_OPAQUE &&
(mAttachInfo == null || !mAttachInfo.mIgnoreDirtyState);
mPrivateFlags = (privateFlags & ~PFLAG_DIRTY_MASK) | PFLAG_DRAWN;
@@ -14472,9 +14498,49 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
// Step 1, draw the background, if needed
int saveCount;
-
+//add by wuyu start
+if(("com.tencent.mm".equals(getTopActivityPackageName()))&&(("com.tencent.mm.ui.LauncherUI".equals(getTopActivityClassName()))||("com.tencent.mm.ui.chatting.ChattingUI".equals(getTopActivityClassName()))))
+{
+dirtyOpaque = false;
+mBackgroundSizeChanged = true;
+if(mBackground != null)
+{
+//mBackground = mContext.getResources().getDrawable(android.R.color.white);
+Log.d("wuyu","canvas.getWidth() = " + canvas.getWidth() + "canvas.getHeight() = " + canvas.getHeight());
+Log.d("wuyu","view.getWidth() = " + getWidth() + "view.getHeight() = " + getHeight());
+Log.d("wuyu","mScrollX = " + mScrollX + ",mScrollY = " + mScrollY + ",mRight = " + mRight + ",mLeft = " + mLeft + ",mBottom = " + mBottom + ",mTop = " + mTop);
+//Log.d("wuyu","mClipBounds.bottom = " + mClipBounds.bottom + ",mClipBounds.left = " + mClipBounds.left + ",mClipBounds.top = " + mClipBounds.top + ",mClipBounds.right = " + mClipBounds.right);
+if(canvas.getHeight() == 29)
+{
+//mBackground = mContext.getResources().getDrawable(android.R.color.holo_blue_light);
+}
+else if(canvas.getHeight() == 24)
+{
+//状态栏
+//mBackground = mContext.getResources().getDrawable(android.R.color.holo_red_dark);
+}
+else if(canvas.getHeight() == 43 )
+{
+//mBackground = mContext.getResources().getDrawable(android.R.color.holo_purple);
+}
+else if(canvas.getHeight() == 34)
+{
+mBackground = mContext.getResources().getDrawable(android.R.color.white);
+}
+else if(canvas.getHeight() == 12)
+{
+//mBackground = mContext.getResources().getDrawable(android.R.color.holo_orange_light);
+}
+else if(canvas.getHeight() == 5)
+{
+//mBackground = mContext.getResources().getDrawable(android.R.color.black);
+}
+}
+}
+
+//add by wuyu end
if (!dirtyOpaque) {
- final Drawable background = mBackground;
+Drawable background = mBackground;
if (background != null) {
final int scrollX = mScrollX;
final int scrollY = mScrollY;
以上修改会导致搜狗输入法起不来,优化去减少判断次数
diff --git a/frameworks/base/core/java/android/view/View.java b/frameworks/base/core/java/android/view/View.java
index b120b86..91a2c40 100644
--- a/frameworks/base/core/java/android/view/View.java
+++ b/frameworks/base/core/java/android/view/View.java
@@ -100,6 +100,10 @@ import java.util.Locale;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicInteger;
+import android.app.ActivityManager;
+import android.app.ActivityManager.RunningTaskInfo;
+import java.util.List;
+import android.provider.Settings;
/**
*
* This class represents the basic building block for user interface components. A View
@@ -14439,7 +14443,30 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
return more;
}
-
+
+//add by wuyu start
+ private String getTopActivityClassName() {
+ String className = null;
+ ActivityManager mActivityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
+ Listlist = mActivityManager.getRunningTasks(1);
+ if (!list.isEmpty() && list.get(0) != null && list.get(0).topActivity != null) {
+ className = list.get(0).topActivity.getClassName();
+Log.d("wuyu","className = " + className);
+ }
+ return className;
+ }
+
+private String getTopActivityPackageName() {
+String packageName = null;
+ ActivityManager mActivityManager = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
+ Listlist = mActivityManager.getRunningTasks(1);
+ if (!list.isEmpty() && list.get(0) != null && list.get(0).topActivity != null) {
+packageName = list.get(0).topActivity.getPackageName();
+Log.d("wuyu","packageName = " + packageName);
+ }
+ return packageName;
+ }
+//add by wuyu end
/**
* Manually render this view (and all of its children) to the given Canvas.
* The view must have already done a full layout before this function is
@@ -14454,7 +14481,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
canvas.clipRect(mClipBounds);
}
final int privateFlags = mPrivateFlags;
- final boolean dirtyOpaque = (privateFlags & PFLAG_DIRTY_MASK) == PFLAG_DIRTY_OPAQUE &&
+ boolean dirtyOpaque = (privateFlags & PFLAG_DIRTY_MASK) == PFLAG_DIRTY_OPAQUE &&
(mAttachInfo == null || !mAttachInfo.mIgnoreDirtyState);
mPrivateFlags = (privateFlags & ~PFLAG_DIRTY_MASK) | PFLAG_DRAWN;
@@ -14472,9 +14499,23 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
// Step 1, draw the background, if needed
int saveCount;
-
+//add by wuyu start
+if(canvas.getHeight() == 34 && (canvas.getWidth() == 240||canvas.getWidth() == 60))
+{
+Log.d("wuyu","canvas.getWidth() = " + canvas.getWidth() + "canvas.getHeight() = " + canvas.getHeight());
+Log.d("wuyu","view.getWidth() = " + getWidth() + "view.getHeight() = " + getHeight());
+Log.d("wuyu","mScrollX = " + mScrollX + ",mScrollY = " + mScrollY + ",mRight = " + mRight + ",mLeft = " + mLeft + ",mBottom = " + mBottom + ",mTop = " + mTop);
+if(("com.tencent.mm".equals(getTopActivityPackageName()))&&(("com.tencent.mm.ui.LauncherUI".equals(getTopActivityClassName()))||("com.tencent.mm.ui.chatting.ChattingUI".equals(getTopActivityClassName()))))
+{
+mBackground = mContext.getResources().getDrawable(android.R.color.white);
+dirtyOpaque = false;
+mBackgroundSizeChanged = true;
+}
+}
+
+//add by wuyu end
if (!dirtyOpaque) {
- final Drawable background = mBackground;
+Drawable background = mBackground;
if (background != null) {
final int scrollX = mScrollX;
final int scrollY = mScrollY;