Merge "transcoding: Allow acquire service on low ram device." into sc-mainline-prod
This commit is contained in:
@@ -22,7 +22,6 @@ import android.annotation.IntRange;
|
|||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.annotation.SystemApi;
|
import android.annotation.SystemApi;
|
||||||
import android.app.ActivityManager;
|
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.AssetFileDescriptor;
|
import android.content.res.AssetFileDescriptor;
|
||||||
@@ -121,7 +120,6 @@ public final class MediaTranscodingManager {
|
|||||||
private final String mPackageName;
|
private final String mPackageName;
|
||||||
private final int mPid;
|
private final int mPid;
|
||||||
private final int mUid;
|
private final int mUid;
|
||||||
private final boolean mIsLowRamDevice;
|
|
||||||
private final ExecutorService mExecutor = Executors.newSingleThreadExecutor();
|
private final ExecutorService mExecutor = Executors.newSingleThreadExecutor();
|
||||||
private final HashMap<Integer, TranscodingSession> mPendingTranscodingSessions = new HashMap();
|
private final HashMap<Integer, TranscodingSession> mPendingTranscodingSessions = new HashMap();
|
||||||
private final Object mLock = new Object();
|
private final Object mLock = new Object();
|
||||||
@@ -208,10 +206,7 @@ public final class MediaTranscodingManager {
|
|||||||
if (!SdkLevel.isAtLeastS()) {
|
if (!SdkLevel.isAtLeastS()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// Do not try to get the service on AndroidGo (low-ram) devices.
|
|
||||||
if (mIsLowRamDevice) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
int retryCount = !retry ? 1 : CONNECT_SERVICE_RETRY_COUNT;
|
int retryCount = !retry ? 1 : CONNECT_SERVICE_RETRY_COUNT;
|
||||||
Log.i(TAG, "get service with retry " + retryCount);
|
Log.i(TAG, "get service with retry " + retryCount);
|
||||||
for (int count = 1; count <= retryCount; count++) {
|
for (int count = 1; count <= retryCount; count++) {
|
||||||
@@ -429,7 +424,6 @@ public final class MediaTranscodingManager {
|
|||||||
mPackageName = mContext.getPackageName();
|
mPackageName = mContext.getPackageName();
|
||||||
mUid = Os.getuid();
|
mUid = Os.getuid();
|
||||||
mPid = Os.getpid();
|
mPid = Os.getpid();
|
||||||
mIsLowRamDevice = mContext.getSystemService(ActivityManager.class).isLowRamDevice();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user