Inform AudioFlinger of device's low RAM attribute
to help it configure it's memory Bug: 9798886 Change-Id: Ia2df59cfcb76f5ff48cca92b107915e2adde899c
This commit is contained in:
@ -22,6 +22,7 @@ import static android.media.AudioManager.RINGER_MODE_SILENT;
|
||||
import static android.media.AudioManager.RINGER_MODE_VIBRATE;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.app.AppOpsManager;
|
||||
import android.app.KeyguardManager;
|
||||
@ -528,6 +529,7 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
|
||||
updateStreamVolumeAlias(false /*updateVolumes*/);
|
||||
createStreamStates();
|
||||
|
||||
readAndSetLowRamDevice();
|
||||
mMediaServerOk = true;
|
||||
|
||||
// Call setRingerModeInt() to apply correct mute
|
||||
@ -3469,6 +3471,8 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
|
||||
// process restarts after a crash, not the first time it is started.
|
||||
AudioSystem.setParameters("restarting=true");
|
||||
|
||||
readAndSetLowRamDevice();
|
||||
|
||||
// Restore device connection states
|
||||
synchronized (mConnectedDevices) {
|
||||
Set set = mConnectedDevices.entrySet();
|
||||
@ -6698,4 +6702,13 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
|
||||
pw.print(" mMainType=0x"); pw.println(Integer.toHexString(mCurAudioRoutes.mMainType));
|
||||
pw.print(" mBluetoothName="); pw.println(mCurAudioRoutes.mBluetoothName);
|
||||
}
|
||||
|
||||
// Inform AudioFlinger of our device's low RAM attribute
|
||||
private static void readAndSetLowRamDevice()
|
||||
{
|
||||
int status = AudioSystem.setLowRamDevice(ActivityManager.isLowRamDeviceStatic());
|
||||
if (status != 0) {
|
||||
Log.w(TAG, "AudioFlinger informed of device's low RAM attribute; status " + status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -403,4 +403,6 @@ public class AudioSystem
|
||||
public static native int getPrimaryOutputFrameCount();
|
||||
public static native int getOutputLatency(int stream);
|
||||
|
||||
public static native int setLowRamDevice(boolean isLowRamDevice);
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user