1.增加Application属性android:gnHeavyWeight

2.在Manifest Application中声明使用属性android:gnHeavyWeight="true"

diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.javaindex 665b606..b81c9d6 100644--- a/core/java/android/content/pm/ApplicationInfo.java+++ b/core/java/android/content/pm/ApplicationInfo.java@@ -301,6 +301,12 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {      */     public static final int FLAG_CANT_SAVE_STATE = 1<<27; +    // Gionee 2011-12-30 huyuke add for CR00XXXX begin+    /**+     * @hide+     */+    public static final int FLAG_GN_HEAVY_WEIGHT = 1<<26;+    // Gionee 2011-12-30 huyuke add for CR00XXXX end     /**      * Flags associated with the application.  Any combination of      * {@link #FLAG_SYSTEM}, {@link #FLAG_DEBUGGABLE}, {@link #FLAG_HAS_CODE},diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.javaindex ff3656c..bc97e46 100644--- a/core/java/android/content/pm/PackageParser.java+++ b/core/java/android/content/pm/PackageParser.java@@ -1519,8 +1519,17 @@ public class PackageParser {             if (sa.getBoolean(                     com.android.internal.R.styleable.AndroidManifestApplication_persistent,                     false)) {+                Log.d(TAG, "HHHHHH parseApplication set FLAG_PERSISTENT pkg: " + pkgName);                 ai.flags |= ApplicationInfo.FLAG_PERSISTENT;             }+           // Gionee 2011-12-30 huyuke add for CR00XXXX begin+            if (sa.getBoolean(+                    com.android.internal.R.styleable.AndroidManifestApplication_gnHeavyWeight,+                    false)) {+                Log.d(TAG, "HHHHHH parseApplication set FLAG_GN_HEAVY_WEIGHT pkg: " + pkgName);+                ai.flags |= ApplicationInfo.FLAG_GN_HEAVY_WEIGHT;+            }+           // Gionee 2011-12-30 huyuke add for CR00XXXX end         }          if ((flags & PARSE_FORWARD_LOCK) != 0) {diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xmlindex f31dfec..6d4d12a 100644--- a/core/res/res/values/attrs_manifest.xml+++ b/core/res/res/values/attrs_manifest.xml@@ -680,6 +680,10 @@         <enum name="preferExternal" value="2" />     </attr> +    <!-- Gionee 2011-12-30 huyuke add for CR00XXXX begin -->+    <attr name="gnHeavyWeight" format="boolean" />+    <!-- Gionee 2011-12-30 huyuke add for CR00XXXX end -->+     <!-- The <code>manifest</code> tag is the root of an          <code>AndroidManifest.xml</code> file,          describing the contents of an Android package (.apk) file.  One@@ -773,6 +777,9 @@              application is running, the user will be informed of this.              @hide -->         <attr name="cantSaveState" format="boolean" />+        <!-- Gionee 2011-12-30 huyuke add for CR00XXXX begin -->+        <attr name="gnHeavyWeight" />+        <!-- Gionee 2011-12-30 huyuke add for CR00XXXX end -->     </declare-styleable>          <!-- The <code>permission</code> tag declares a security permission that can bediff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xmlindex 4005e96..19c9189 100644--- a/core/res/res/values/public.xml+++ b/core/res/res/values/public.xml@@ -572,6 +572,9 @@   <public type="attr" name="listChoiceIndicatorMultiple" id="0x0101021a" />   <public type="attr" name="versionCode" id="0x0101021b" />   <public type="attr" name="versionName" id="0x0101021c" />+  <!-- Gionee 2011-12-30 huyuke add for CR00XXXX begin -->+  <public type="attr" name="gnHeavyWeight" id="0x010102dd" />+  <!-- Gionee 2011-12-30 huyuke add for CR00XXXX end -->    <public type="id" name="background" id="0x01020000" />   <public type="id" name="checkbox" id="0x01020001" />diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.javaindex 6db4559..529defe 100644--- a/services/java/com/android/server/am/ActivityManagerService.java+++ b/services/java/com/android/server/am/ActivityManagerService.java@@ -142,7 +142,7 @@ import java.util.concurrent.atomic.AtomicLong; public final class ActivityManagerService extends ActivityManagerNative         implements Watchdog.Monitor, BatteryStatsImpl.BatteryCallback {     static final String TAG = "ActivityManager";-    static final boolean DEBUG = false;+    static final boolean DEBUG = true;     static final boolean localLOGV = DEBUG ? Config.LOGD : Config.LOGV;     static final boolean DEBUG_SWITCH = localLOGV || false;     static final boolean DEBUG_TASKS = localLOGV || false;@@ -309,6 +309,9 @@ public final class ActivityManagerService extends ActivityManagerNative     // don't want to kill it, but doing so is not completely fatal.     static final int CORE_SERVER_ADJ = -12; +    // Gionee 2011-12-30 huyuke add for CR00XXXX begin+    static final int GN_CORE_SERVER_ADJ = -1;+    // Gionee 2011-12-30 huyuke add for CR00XXXX end     // The system process runs at the default adjustment.     static final int SYSTEM_ADJ = -16; @@ -3640,6 +3643,14 @@ public final class ActivityManagerService extends ActivityManagerNative             return false;         } +        // Gionee 2011-12-30 huyuke add for CR00XXXX begin+        Log.d(TAG, "HHHHHH attachApplicationLocked: " + app.info.processName);+        if ((app.info.flags&(ApplicationInfo.FLAG_SYSTEM|ApplicationInfo.FLAG_GN_HEAVY_WEIGHT))+                == (ApplicationInfo.FLAG_SYSTEM|ApplicationInfo.FLAG_GN_HEAVY_WEIGHT)) {+            Log.d(TAG, "HHHHHH attachApplicationLocked gn heavy app: " + app.info.processName);+            app.maxAdj = GN_CORE_SERVER_ADJ;+        }+        // Gionee 2011-12-30 huyuke add for CR00XXXX end         if (!didSomething) {             updateOomAdjLocked();         }@@ -5616,6 +5627,7 @@ public final class ActivityManagerService extends ActivityManagerNative     final ProcessRecord addAppLocked(ApplicationInfo info) {         ProcessRecord app = getProcessRecordLocked(info.processName, info.uid); +        Log.d(TAG, "HHHHHH addAppLocked: " + info.processName);         if (app == null) {             app = newProcessRecordLocked(null, info, null);             mProcessNames.put(info.processName, info.uid, app);@@ -5624,6 +5636,7 @@ public final class ActivityManagerService extends ActivityManagerNative          if ((info.flags&(ApplicationInfo.FLAG_SYSTEM|ApplicationInfo.FLAG_PERSISTENT))                 == (ApplicationInfo.FLAG_SYSTEM|ApplicationInfo.FLAG_PERSISTENT)) {+            Log.d(TAG, "HHHHHH persistent app: " + info.processName);             app.persistent = true;             app.maxAdj = CORE_SERVER_ADJ;         }


更多相关文章

  1. Android 5.0 默认水波纹背景属性,可设置任何View
  2. RelativeLayout用到的一些重要的属性(自己在网上找的)
  3. android TextView属性汇总
  4. ListView 常用属性 详解
  5. Android中MaterialDesign使用 (四)CoordinatorLayout初识:AppBar
  6. RealtiveLayout(相对布局属性)
  7. 各种Layout用到的一些重要的属性

随机推荐

  1. Android Studio Gradle多渠道打包
  2. ANDROID 后台服务 service
  3. Android GPS获取当前经纬度坐标
  4. Android之如何解决Android(安卓)Studio左
  5. 调整Android手机的默认亮度
  6. android中异步任务AsyncTask的应用和工作
  7. Android个人笔记 - Google Android揭秘_
  8. Android自带音乐播放器代码分析(2)
  9. Android:serializable和parcelable
  10. Android(安卓)使用ORMLite打造万能泛型Da