From 62eb00af49ab2497335645fde4a9d7f994af7be1 Mon Sep 17 00:00:00 2001 From: Juju Sung Date: Fri, 23 Nov 2018 16:36:51 +0800 Subject: [PATCH] Fix lowMemoryKill with app2.MyService MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MyForegroundService.java will change to background service during testing,It’s ADJ will be 900. When run on a 512M project, it will easily killed due to low memory. Only set BIND_NOT_FOREGROUND and remove BIND_ALLOW_OOM_MANAGEMENT. So MyForegroundService can still change process state between foreground and background by startFround()/stopFround(). But it's ADJ will not too high in background. Bug: 120038371 Test: VTS, ran the test 5 times and it passed 5 times Change-Id: I555366db7dd9904bc119bea94efbbe6422764f69 --- .../app/src/com/android/cts/net/hostside/MyServiceClient.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/cts/hostside/app/src/com/android/cts/net/hostside/MyServiceClient.java b/tests/cts/hostside/app/src/com/android/cts/net/hostside/MyServiceClient.java index ff05d8c2fc..e2976c2150 100644 --- a/tests/cts/hostside/app/src/com/android/cts/net/hostside/MyServiceClient.java +++ b/tests/cts/hostside/app/src/com/android/cts/net/hostside/MyServiceClient.java @@ -62,10 +62,10 @@ public class MyServiceClient { final Intent intent = new Intent(); intent.setComponent(new ComponentName(APP2_PACKAGE, SERVICE_NAME)); - // Needs to use BIND_ALLOW_OOM_MANAGEMENT and BIND_NOT_FOREGROUND so app2 does not run in + // Needs to use BIND_NOT_FOREGROUND so app2 does not run in // the same process state as app mContext.bindService(intent, mServiceConnection, Context.BIND_AUTO_CREATE - | Context.BIND_ALLOW_OOM_MANAGEMENT | Context.BIND_NOT_FOREGROUND); + | Context.BIND_NOT_FOREGROUND); cv.block(TIMEOUT_MS); if (mService == null) { throw new IllegalStateException(