Merge "Properly identify malformed (too short) chunks in mpeg4 files." into gingerbread
diff --git a/api/current.xml b/api/current.xml
index f8c644e..8cc95ab 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -21750,6 +21750,17 @@
visibility="public"
>
</field>
+<field name="FLAG_HEAVY_WEIGHT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="IMPORTANCE_BACKGROUND"
type="int"
transient="false"
@@ -21860,6 +21871,16 @@
visibility="public"
>
</field>
+<field name="flags"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
<field name="importance"
type="int"
transient="false"
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index 7f95bf5..eb7520f 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -717,9 +717,24 @@
*/
public int uid;
+ /**
+ * All packages that have been loaded into the process.
+ */
public String pkgList[];
/**
+ * Constant for {@link #flags}: this is a heavy-weight process,
+ * meaning it will not be killed while in the background.
+ */
+ public static final int FLAG_HEAVY_WEIGHT = 1<<0;
+
+ /**
+ * Flags of information. May be any of
+ * {@link #FLAG_HEAVY_WEIGHT}.
+ */
+ public int flags;
+
+ /**
* Constant for {@link #importance}: this process is running the
* foreground UI.
*/
@@ -846,6 +861,7 @@
dest.writeInt(pid);
dest.writeInt(uid);
dest.writeStringArray(pkgList);
+ dest.writeInt(this.flags);
dest.writeInt(importance);
dest.writeInt(lru);
dest.writeInt(importanceReasonCode);
@@ -858,6 +874,7 @@
pid = source.readInt();
uid = source.readInt();
pkgList = source.readStringArray();
+ flags = source.readInt();
importance = source.readInt();
lru = source.readInt();
importanceReasonCode = source.readInt();
diff --git a/core/java/android/hardware/Usb.java b/core/java/android/hardware/Usb.java
new file mode 100644
index 0000000..e9c2cf7
--- /dev/null
+++ b/core/java/android/hardware/Usb.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package android.hardware;
+
+/**
+ * Class for accessing USB state information.
+ * @hide
+ */
+public class Usb {
+ /**
+ * Broadcast Action: A broadcast for USB connected events.
+ *
+ * The extras bundle will name/value pairs with the name of the function
+ * and a value of either {@link #USB_FUNCTION_ENABLED} or {@link #USB_FUNCTION_DISABLED}.
+ * Possible USB function names include {@link #USB_FUNCTION_MASS_STORAGE},
+ * {@link #USB_FUNCTION_ADB}, {@link #USB_FUNCTION_RNDIS} and {@link #USB_FUNCTION_MTP}.
+ */
+ public static final String ACTION_USB_CONNECTED =
+ "android.hardware.action.USB_CONNECTED";
+
+ /**
+ * Broadcast Action: A broadcast for USB disconnected events.
+ */
+ public static final String ACTION_USB_DISCONNECTED =
+ "android.hardware.action.USB_DISCONNECTED";
+
+
+ /**
+ * Name of the USB mass storage USB function.
+ * Used in extras for the {@link #ACTION_USB_CONNECTED} broadcast
+ */
+ public static final String USB_FUNCTION_MASS_STORAGE = "mass_storage";
+
+ /**
+ * Name of the adb USB function.
+ * Used in extras for the {@link #ACTION_USB_CONNECTED} broadcast
+ */
+ public static final String USB_FUNCTION_ADB = "adb";
+
+ /**
+ * Name of the RNDIS ethernet USB function.
+ * Used in extras for the {@link #ACTION_USB_CONNECTED} broadcast
+ */
+ public static final String USB_FUNCTION_RNDIS = "rndis";
+
+ /**
+ * Name of the MTP USB function.
+ * Used in extras for the {@link #ACTION_USB_CONNECTED} broadcast
+ */
+ public static final String USB_FUNCTION_MTP = "mtp";
+
+ /**
+ * Value indicating that a USB function is enabled.
+ * Used in extras for the {@link #ACTION_USB_CONNECTED} broadcast
+ */
+ public static final String USB_FUNCTION_ENABLED = "enabled";
+
+ /**
+ * Value indicating that a USB function is disabled.
+ * Used in extras for the {@link #ACTION_USB_CONNECTED} broadcast
+ */
+ public static final String USB_FUNCTION_DISABLED = "disabled";
+}
diff --git a/core/jni/android_bluetooth_HeadsetBase.cpp b/core/jni/android_bluetooth_HeadsetBase.cpp
index 5593a26..4e9fbaf 100644
--- a/core/jni/android_bluetooth_HeadsetBase.cpp
+++ b/core/jni/android_bluetooth_HeadsetBase.cpp
@@ -169,7 +169,7 @@
// never receive non-ASCII UTF-8).
// This was added because of the BMW 2005 E46 which sends binary junk.
if (is_ascii(buf)) {
- LOG(LOG_INFO, "Bluetooth AT recv", "%s", buf);
+ IF_LOGV() LOG(LOG_VERBOSE, "Bluetooth AT recv", "%s", buf);
} else {
LOGW("Ignoring invalid AT command: %s", buf);
buf[0] = NULL;
@@ -494,7 +494,7 @@
}
}
}
- LOG(LOG_INFO, "Bluetooth AT sent", "%s", buf);
+ IF_LOGV() LOG(LOG_VERBOSE, "Bluetooth AT sent", "%s", buf);
free(buf);
}
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index aff9453..b1f81df 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -80,6 +80,9 @@
<protected-broadcast android:name="android.bluetooth.device.action.PAIRING_REQUEST" />
<protected-broadcast android:name="android.bluetooth.device.action.PAIRING_CANCEL" />
+ <protected-broadcast android:name="android.hardware.action.USB_CONNECTED" />
+ <protected-broadcast android:name="android.hardware.action.USB_DISCONNECTED" />
+
<!-- ====================================== -->
<!-- Permissions for things that cost money -->
<!-- ====================================== -->
@@ -436,6 +439,14 @@
android:label="@string/permlab_flashlight"
android:description="@string/permdesc_flashlight" />
+ <!-- Allows an application to access USB devices
+ @hide -->
+ <permission android:name="android.permission.ACCESS_USB"
+ android:permissionGroup="android.permission-group.HARDWARE_CONTROLS"
+ android:protectionLevel="signatureOrSystem"
+ android:label="@string/permlab_accessUsb"
+ android:description="@string/permdesc_accessUsb" />
+
<!-- Allows access to hardware peripherals. Intended only for hardware testing -->
<permission android:name="android.permission.HARDWARE_TEST"
android:permissionGroup="android.permission-group.HARDWARE_CONTROLS"
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index 3c1fdbc..44317bc 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -939,6 +939,11 @@
the flashlight.</string>
<!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permlab_accessUsb">access USB devices</string>
+ <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
+ <string name="permdesc_accessUsb">Allows the application to access USB devices.</string>
+
+ <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permlab_hardware_test">test hardware</string>
<!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
<string name="permdesc_hardware_test">Allows the application to control
diff --git a/media/libstagefright/MPEG4Writer.cpp b/media/libstagefright/MPEG4Writer.cpp
index 4242d36..f16b225 100644
--- a/media/libstagefright/MPEG4Writer.cpp
+++ b/media/libstagefright/MPEG4Writer.cpp
@@ -185,7 +185,7 @@
return UNKNOWN_ERROR;
}
- mStartTimestampUs = 0;
+ mStartTimestampUs = -1;
if (mStarted) {
if (mPaused) {
mPaused = false;
@@ -561,8 +561,7 @@
LOGI("setStartTimestampUs: %lld", timeUs);
CHECK(timeUs >= 0);
Mutex::Autolock autoLock(mLock);
- if (mStartTimestampUs == 0 ||
- (mStartTimestampUs > 0 && mStartTimestampUs > timeUs)) {
+ if (mStartTimestampUs < 0 || mStartTimestampUs > timeUs) {
mStartTimestampUs = timeUs;
LOGI("Earliest track starting time: %lld", mStartTimestampUs);
}
diff --git a/media/libstagefright/codecs/aacenc/AACEncoder.cpp b/media/libstagefright/codecs/aacenc/AACEncoder.cpp
index 52204fa..b914023 100644
--- a/media/libstagefright/codecs/aacenc/AACEncoder.cpp
+++ b/media/libstagefright/codecs/aacenc/AACEncoder.cpp
@@ -139,6 +139,8 @@
CHECK_EQ(OK, initCheck());
+ mNumInputSamples = 0;
+ mAnchorTimeUs = 0;
mFrameCount = 0;
mSource->start(params);
@@ -205,33 +207,65 @@
buffer->set_range(0, 2);
buffer->meta_data()->setInt32(kKeyIsCodecConfig, true);
*out = buffer;
- mInputBuffer = NULL;
++mFrameCount;
return OK;
} else if (mFrameCount == 1) {
buffer->meta_data()->setInt32(kKeyIsCodecConfig, false);
}
- // XXX: We assume that the input buffer contains at least
- // (actually, exactly) 1024 PCM samples. This needs to be fixed.
- if (mInputBuffer == NULL) {
- if (mSource->read(&mInputBuffer, options) != OK) {
- LOGE("failed to read from input audio source");
- return UNKNOWN_ERROR;
+ while (mNumInputSamples < kNumSamplesPerFrame) {
+ if (mInputBuffer == NULL) {
+ if (mSource->read(&mInputBuffer, options) != OK) {
+ if (mNumInputSamples == 0) {
+ return ERROR_END_OF_STREAM;
+ }
+ memset(&mInputFrame[mNumInputSamples],
+ 0,
+ sizeof(int16_t) * (kNumSamplesPerFrame - mNumInputSamples));
+ mNumInputSamples = 0;
+ break;
+ }
+
+ size_t align = mInputBuffer->range_length() % sizeof(int16_t);
+ CHECK_EQ(align, 0);
+
+ int64_t timeUs;
+ if (mInputBuffer->meta_data()->findInt64(kKeyTime, &timeUs)) {
+ mAnchorTimeUs = timeUs;
+ }
}
+ size_t copy =
+ (kNumSamplesPerFrame - mNumInputSamples) * sizeof(int16_t);
+
+ if (copy > mInputBuffer->range_length()) {
+ copy = mInputBuffer->range_length();
+ }
+
+ memcpy(&mInputFrame[mNumInputSamples],
+ (const uint8_t *) mInputBuffer->data()
+ + mInputBuffer->range_offset(),
+ copy);
+
+ mInputBuffer->set_range(
+ mInputBuffer->range_offset() + copy,
+ mInputBuffer->range_length() - copy);
+
if (mInputBuffer->range_length() == 0) {
mInputBuffer->release();
mInputBuffer = NULL;
- return ERROR_END_OF_STREAM;
}
- VO_CODECBUFFER inputData;
- memset(&inputData, 0, sizeof(inputData));
- inputData.Buffer = (unsigned char*) mInputBuffer->data();
- inputData.Length = mInputBuffer->range_length();
- CHECK(VO_ERR_NONE == mApiHandle->SetInputData(mEncoderHandle,&inputData));
+ mNumInputSamples += copy / sizeof(int16_t);
+ if (mNumInputSamples >= kNumSamplesPerFrame) {
+ mNumInputSamples %= kNumSamplesPerFrame;
+ break;
+ }
}
- CHECK(mInputBuffer != NULL);
+ VO_CODECBUFFER inputData;
+ memset(&inputData, 0, sizeof(inputData));
+ inputData.Buffer = (unsigned char*) mInputFrame;
+ inputData.Length = kNumSamplesPerFrame * sizeof(int16_t);
+ CHECK(VO_ERR_NONE == mApiHandle->SetInputData(mEncoderHandle,&inputData));
VO_CODECBUFFER outputData;
memset(&outputData, 0, sizeof(outputData));
@@ -239,24 +273,14 @@
memset(&outputInfo, 0, sizeof(outputInfo));
VO_U32 ret = VO_ERR_NONE;
- int32_t outputLength = 0;
outputData.Buffer = outPtr;
outputData.Length = buffer->size();
ret = mApiHandle->GetOutputData(mEncoderHandle, &outputData, &outputInfo);
- if (ret == VO_ERR_NONE || ret == VO_ERR_INPUT_BUFFER_SMALL) {
- outputLength += outputData.Length;
- if (ret == VO_ERR_INPUT_BUFFER_SMALL) { // All done
- mInputBuffer->release();
- mInputBuffer = NULL;
- }
- } else {
- LOGE("failed to encode the input data 0x%lx", ret);
- }
+ CHECK(ret == VO_ERR_NONE || ret == VO_ERR_INPUT_BUFFER_SMALL);
+ CHECK(outputData.Length != 0);
+ buffer->set_range(0, outputData.Length);
- buffer->set_range(0, outputLength);
-
- // Each output frame compresses 1024 input PCM samples.
- int64_t timestampUs = ((mFrameCount - 1) * 1000000LL * 1024) / mSampleRate;
+ int64_t timestampUs = ((mFrameCount - 1) * 1000000LL * kNumSamplesPerFrame) / mSampleRate;
++mFrameCount;
buffer->meta_data()->setInt64(kKeyTime, timestampUs);
diff --git a/media/libstagefright/include/AACEncoder.h b/media/libstagefright/include/AACEncoder.h
index 211a332..ecc533f 100644
--- a/media/libstagefright/include/AACEncoder.h
+++ b/media/libstagefright/include/AACEncoder.h
@@ -52,6 +52,16 @@
int32_t mChannels;
int32_t mBitRate;
int32_t mFrameCount;
+
+ int64_t mAnchorTimeUs;
+ int64_t mNumInputSamples;
+
+ enum {
+ kNumSamplesPerFrame = 1024,
+ };
+
+ int16_t mInputFrame[kNumSamplesPerFrame];
+
uint8_t mAudioSpecificConfigData[2]; // auido specific data
void *mEncoderHandle;
VO_AUDIO_CODECAPI *mApiHandle;
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index b91bf73..7130636 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -96,6 +96,7 @@
BluetoothA2dpService bluetoothA2dp = null;
HeadsetObserver headset = null;
DockObserver dock = null;
+ UsbObserver usb = null;
UiModeManagerService uiMode = null;
RecognitionManagerService recognition = null;
ThrottleService throttle = null;
@@ -373,8 +374,16 @@
}
try {
+ Slog.i(TAG, "USB Observer");
+ // Listen for USB changes
+ usb = new UsbObserver(context);
+ } catch (Throwable e) {
+ Slog.e(TAG, "Failure starting UsbObserver", e);
+ }
+
+ try {
Slog.i(TAG, "UI Mode Manager Service");
- // Listen for dock station changes
+ // Listen for UI mode changes
uiMode = new UiModeManagerService(context);
} catch (Throwable e) {
Slog.e(TAG, "Failure starting UiModeManagerService", e);
@@ -461,6 +470,7 @@
final BatteryService batteryF = battery;
final ConnectivityService connectivityF = connectivity;
final DockObserver dockF = dock;
+ final UsbObserver usbF = usb;
final ThrottleService throttleF = throttle;
final UiModeManagerService uiModeF = uiMode;
final AppWidgetService appWidgetF = appWidget;
@@ -483,6 +493,7 @@
if (batteryF != null) batteryF.systemReady();
if (connectivityF != null) connectivityF.systemReady();
if (dockF != null) dockF.systemReady();
+ if (usbF != null) usbF.systemReady();
if (uiModeF != null) uiModeF.systemReady();
if (recognitionF != null) recognitionF.systemReady();
Watchdog.getInstance().start();
diff --git a/services/java/com/android/server/UsbObserver.java b/services/java/com/android/server/UsbObserver.java
new file mode 100644
index 0000000..3993a7f
--- /dev/null
+++ b/services/java/com/android/server/UsbObserver.java
@@ -0,0 +1,197 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.server;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.Intent;
+import android.hardware.Usb;
+import android.net.Uri;
+import android.os.Handler;
+import android.os.Message;
+import android.os.UEventObserver;
+import android.provider.Settings;
+import android.util.Log;
+import android.util.Slog;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.util.ArrayList;
+
+/**
+ * <p>UsbObserver monitors for changes to USB state.
+ */
+class UsbObserver extends UEventObserver {
+ private static final String TAG = UsbObserver.class.getSimpleName();
+ private static final boolean LOG = false;
+
+ private static final String USB_CONFIGURATION_MATCH = "DEVPATH=/devices/virtual/switch/usb_configuration";
+ private static final String USB_FUNCTIONS_MATCH = "DEVPATH=/devices/virtual/usb_composite/";
+ private static final String USB_CONFIGURATION_PATH = "/sys/class/switch/usb_configuration/state";
+ private static final String USB_COMPOSITE_CLASS_PATH = "/sys/class/usb_composite";
+
+ private static final int MSG_UPDATE = 0;
+
+ private int mUsbConfig = 0;
+ private int mPreviousUsbConfig = 0;
+
+ // lists of enabled and disabled USB functions
+ private final ArrayList<String> mEnabledFunctions = new ArrayList<String>();
+ private final ArrayList<String> mDisabledFunctions = new ArrayList<String>();
+
+ private boolean mSystemReady;
+
+ private final Context mContext;
+
+ private PowerManagerService mPowerManager;
+
+ public UsbObserver(Context context) {
+ mContext = context;
+ init(); // set initial status
+
+ startObserving(USB_CONFIGURATION_MATCH);
+ startObserving(USB_FUNCTIONS_MATCH);
+ }
+
+ @Override
+ public void onUEvent(UEventObserver.UEvent event) {
+ if (Log.isLoggable(TAG, Log.VERBOSE)) {
+ Slog.v(TAG, "USB UEVENT: " + event.toString());
+ }
+
+ synchronized (this) {
+ String switchState = event.get("SWITCH_STATE");
+ if (switchState != null) {
+ try {
+ int newConfig = Integer.parseInt(switchState);
+ if (newConfig != mUsbConfig) {
+ mPreviousUsbConfig = mUsbConfig;
+ mUsbConfig = newConfig;
+ // trigger an Intent broadcast
+ if (mSystemReady) {
+ update();
+ }
+ }
+ } catch (NumberFormatException e) {
+ Slog.e(TAG, "Could not parse switch state from event " + event);
+ }
+ } else {
+ String function = event.get("FUNCTION");
+ String enabledStr = event.get("ENABLED");
+ if (function != null && enabledStr != null) {
+ // Note: we do not broadcast a change when a function is enabled or disabled.
+ // We just record the state change for the next broadcast.
+ boolean enabled = "1".equals(enabledStr);
+ if (enabled) {
+ if (!mEnabledFunctions.contains(function)) {
+ mEnabledFunctions.add(function);
+ }
+ mDisabledFunctions.remove(function);
+ } else {
+ if (!mDisabledFunctions.contains(function)) {
+ mDisabledFunctions.add(function);
+ }
+ mEnabledFunctions.remove(function);
+ }
+ }
+ }
+ }
+ }
+ private final void init() {
+ char[] buffer = new char[1024];
+
+ try {
+ FileReader file = new FileReader(USB_CONFIGURATION_PATH);
+ int len = file.read(buffer, 0, 1024);
+ mPreviousUsbConfig = mUsbConfig = Integer.valueOf((new String(buffer, 0, len)).trim());
+
+ } catch (FileNotFoundException e) {
+ Slog.w(TAG, "This kernel does not have USB configuration switch support");
+ } catch (Exception e) {
+ Slog.e(TAG, "" , e);
+ }
+
+ try {
+ File[] files = new File(USB_COMPOSITE_CLASS_PATH).listFiles();
+ for (int i = 0; i < files.length; i++) {
+ File file = new File(files[i], "enable");
+ FileReader reader = new FileReader(file);
+ int len = reader.read(buffer, 0, 1024);
+ int value = Integer.valueOf((new String(buffer, 0, len)).trim());
+ String functionName = files[i].getName();
+ if (value == 1) {
+ mEnabledFunctions.add(functionName);
+ } else {
+ mDisabledFunctions.add(functionName);
+ }
+ }
+ } catch (FileNotFoundException e) {
+ Slog.w(TAG, "This kernel does not have USB composite class support");
+ } catch (Exception e) {
+ Slog.e(TAG, "" , e);
+ }
+ }
+
+ void systemReady() {
+ synchronized (this) {
+ update();
+ mSystemReady = true;
+ }
+ }
+
+ private final void update() {
+ mHandler.sendEmptyMessage(MSG_UPDATE);
+ }
+
+ private final Handler mHandler = new Handler() {
+ @Override
+ public void handleMessage(Message msg) {
+ switch (msg.what) {
+ case MSG_UPDATE:
+ synchronized (this) {
+ final ContentResolver cr = mContext.getContentResolver();
+
+ if (Settings.Secure.getInt(cr,
+ Settings.Secure.DEVICE_PROVISIONED, 0) == 0) {
+ Slog.i(TAG, "Device not provisioned, skipping USB broadcast");
+ return;
+ }
+ // Send an Intent containing connected/disconnected state
+ // and the enabled/disabled state of all USB functions
+ Intent intent;
+ if (mUsbConfig != 0) {
+ intent = new Intent(Usb.ACTION_USB_CONNECTED);
+
+ // include state of all USB functions in our extras
+ for (int i = 0; i < mEnabledFunctions.size(); i++) {
+ intent.putExtra(mEnabledFunctions.get(i), Usb.USB_FUNCTION_ENABLED);
+ }
+ for (int i = 0; i < mDisabledFunctions.size(); i++) {
+ intent.putExtra(mDisabledFunctions.get(i), Usb.USB_FUNCTION_DISABLED);
+ }
+ } else {
+ intent = new Intent(Usb.ACTION_USB_DISCONNECTED);
+ }
+
+ mContext.sendBroadcast(intent, android.Manifest.permission.ACCESS_USB);
+ }
+ break;
+ }
+ }
+ };
+}
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index d59ecdd..b3f49d9 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -9814,6 +9814,9 @@
new ActivityManager.RunningAppProcessInfo(app.processName,
app.pid, app.getPackageList());
currApp.uid = app.info.uid;
+ if (mHeavyWeightProcess == app) {
+ currApp.flags |= ActivityManager.RunningAppProcessInfo.FLAG_HEAVY_WEIGHT;
+ }
int adj = app.curAdj;
if (adj >= EMPTY_APP_ADJ) {
currApp.importance = ActivityManager.RunningAppProcessInfo.IMPORTANCE_EMPTY;