remove proxy binder service IIncrementalManager
This is no longer needed because native Incremental Service directly uses IDataLoaderManager. BUG: 150406132 Test: atest service.incremental_test Test: atest PackageManagerShellCommandIncrementalTest Change-Id: Idbde2988883becbf3eb707d42c0558774a6073e8
This commit is contained in:
@@ -981,7 +981,6 @@ filegroup {
|
||||
filegroup {
|
||||
name: "incremental_manager_aidl",
|
||||
srcs: [
|
||||
"core/java/android/os/incremental/IIncrementalManager.aidl",
|
||||
"core/java/android/os/incremental/IIncrementalService.aidl",
|
||||
"core/java/android/os/incremental/IncrementalNewFileParams.aidl",
|
||||
"core/java/android/os/incremental/IncrementalSignature.aidl",
|
||||
|
||||
@@ -1297,9 +1297,6 @@ public final class SystemServiceRegistry {
|
||||
throws ServiceNotFoundException {
|
||||
return new LightsManager(ctx);
|
||||
}});
|
||||
//TODO(b/136132412): refactor this: 1) merge IIncrementalManager.aidl and
|
||||
//IIncrementalManagerNative.aidl, 2) implement the binder interface in
|
||||
//IncrementalManagerService.java, 3) use JNI to call native functions
|
||||
registerService(Context.INCREMENTAL_SERVICE, IncrementalManager.class,
|
||||
new CachedServiceFetcher<IncrementalManager>() {
|
||||
@Override
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 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.os.incremental;
|
||||
|
||||
import android.content.pm.FileSystemControlParcel;
|
||||
import android.content.pm.DataLoaderParamsParcel;
|
||||
import android.content.pm.IDataLoaderStatusListener;
|
||||
|
||||
/**
|
||||
* Binder service to receive calls from native Incremental Service and handle Java tasks such as
|
||||
* looking up data loader service package names, binding and talking to the data loader service.
|
||||
* @hide
|
||||
*/
|
||||
interface IIncrementalManager {
|
||||
boolean prepareDataLoader(int mountId,
|
||||
in FileSystemControlParcel control,
|
||||
in DataLoaderParamsParcel params,
|
||||
in IDataLoaderStatusListener listener);
|
||||
boolean startDataLoader(int mountId);
|
||||
void showHealthBlockedUI(int mountId);
|
||||
void destroyDataLoader(int mountId);
|
||||
}
|
||||
@@ -16817,10 +16817,6 @@ HSPLcom/android/server/incident/RequestQueue;-><init>(Landroid/os/Handler;)V
|
||||
PLcom/android/server/incident/RequestQueue;->access$000(Lcom/android/server/incident/RequestQueue;)Ljava/util/ArrayList;
|
||||
PLcom/android/server/incident/RequestQueue;->enqueue(Landroid/os/IBinder;ZLjava/lang/Runnable;)V
|
||||
PLcom/android/server/incident/RequestQueue;->start()V
|
||||
HSPLcom/android/server/incremental/IncrementalManagerService;-><init>(Landroid/content/Context;)V
|
||||
PLcom/android/server/incremental/IncrementalManagerService;->dump(Ljava/io/FileDescriptor;Ljava/io/PrintWriter;[Ljava/lang/String;)V
|
||||
HSPLcom/android/server/incremental/IncrementalManagerService;->start(Landroid/content/Context;)Lcom/android/server/incremental/IncrementalManagerService;
|
||||
PLcom/android/server/incremental/IncrementalManagerService;->systemReady()V
|
||||
HPLcom/android/server/infra/-$$Lambda$AbstractMasterSystemService$1$TLhe3_2yHs5UB69Y7lf2s7OxJCo;-><init>(Ljava/lang/String;)V
|
||||
PLcom/android/server/infra/-$$Lambda$AbstractMasterSystemService$1$TLhe3_2yHs5UB69Y7lf2s7OxJCo;->visit(Ljava/lang/Object;)V
|
||||
HSPLcom/android/server/infra/-$$Lambda$AbstractMasterSystemService$_fKw-VUP0pSfcMMlgRqoT4OPhxw;-><init>(Lcom/android/server/infra/AbstractMasterSystemService;Ljava/lang/String;)V
|
||||
@@ -43466,8 +43462,6 @@ Lcom/android/server/incident/PendingReports;
|
||||
Lcom/android/server/incident/RequestQueue$1;
|
||||
Lcom/android/server/incident/RequestQueue$Rec;
|
||||
Lcom/android/server/incident/RequestQueue;
|
||||
Lcom/android/server/incremental/IncrementalManagerService;
|
||||
Lcom/android/server/incremental/IncrementalManagerShellCommand;
|
||||
Lcom/android/server/infra/-$$Lambda$AbstractMasterSystemService$1$TLhe3_2yHs5UB69Y7lf2s7OxJCo;
|
||||
Lcom/android/server/infra/-$$Lambda$AbstractMasterSystemService$_fKw-VUP0pSfcMMlgRqoT4OPhxw;
|
||||
Lcom/android/server/infra/-$$Lambda$AbstractMasterSystemService$su3lJpEVIbL-C7doP4eboTpqjxU;
|
||||
|
||||
@@ -1,146 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 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.incremental;
|
||||
|
||||
import android.annotation.NonNull;
|
||||
import android.content.Context;
|
||||
import android.content.pm.DataLoaderManager;
|
||||
import android.content.pm.DataLoaderParamsParcel;
|
||||
import android.content.pm.FileSystemControlParcel;
|
||||
import android.content.pm.IDataLoader;
|
||||
import android.content.pm.IDataLoaderStatusListener;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.incremental.IIncrementalManager;
|
||||
import android.util.Slog;
|
||||
|
||||
import com.android.internal.util.DumpUtils;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/**
|
||||
* This service has the following purposes:
|
||||
* 1) Starts the IIncrementalManager binder service.
|
||||
* 1) Starts the native IIncrementalManagerService binder service.
|
||||
* 2) Handles shell commands for "incremental" service.
|
||||
* 3) Handles binder calls from the native IIncrementalManagerService binder service and pass
|
||||
* them to a data loader binder service.
|
||||
*/
|
||||
|
||||
public class IncrementalManagerService extends IIncrementalManager.Stub {
|
||||
private static final String TAG = "IncrementalManagerService";
|
||||
private static final String BINDER_SERVICE_NAME = "incremental";
|
||||
// DataLoaderManagerService should have been started before us
|
||||
private @NonNull DataLoaderManager mDataLoaderManager;
|
||||
private long mNativeInstance;
|
||||
private final @NonNull Context mContext;
|
||||
|
||||
/**
|
||||
* Starts IIncrementalManager binder service and register to Service Manager.
|
||||
* Starts the native IIncrementalManagerNative binder service.
|
||||
*/
|
||||
public static IncrementalManagerService start(Context context) {
|
||||
IncrementalManagerService self = new IncrementalManagerService(context);
|
||||
if (self.mNativeInstance == 0) {
|
||||
return null;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
private IncrementalManagerService(Context context) {
|
||||
mContext = context;
|
||||
mDataLoaderManager = mContext.getSystemService(DataLoaderManager.class);
|
||||
ServiceManager.addService(BINDER_SERVICE_NAME, this);
|
||||
// Starts and register IIncrementalManagerNative service
|
||||
mNativeInstance = nativeStartService();
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
@Override
|
||||
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
if (!DumpUtils.checkDumpAndUsageStatsPermission(mContext, TAG, pw)) return;
|
||||
nativeDump(mNativeInstance, fd.getInt$());
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifies native IIncrementalManager service that system is ready.
|
||||
*/
|
||||
public void systemReady() {
|
||||
nativeSystemReady(mNativeInstance);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds data loader service provider and binds to it. This requires PackageManager.
|
||||
*/
|
||||
@Override
|
||||
public boolean prepareDataLoader(int mountId, FileSystemControlParcel control,
|
||||
DataLoaderParamsParcel params,
|
||||
IDataLoaderStatusListener listener) {
|
||||
DataLoaderManager dataLoaderManager = mContext.getSystemService(DataLoaderManager.class);
|
||||
if (dataLoaderManager == null) {
|
||||
Slog.e(TAG, "Failed to find data loader manager service");
|
||||
return false;
|
||||
}
|
||||
if (!dataLoaderManager.initializeDataLoader(mountId, params, control, listener)) {
|
||||
Slog.e(TAG, "Failed to initialize data loader");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean startDataLoader(int mountId) {
|
||||
IDataLoader dataLoader = mDataLoaderManager.getDataLoader(mountId);
|
||||
if (dataLoader == null) {
|
||||
Slog.e(TAG, "Start failed to retrieve data loader for ID=" + mountId);
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
dataLoader.start();
|
||||
return true;
|
||||
} catch (RemoteException ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyDataLoader(int mountId) {
|
||||
IDataLoader dataLoader = mDataLoaderManager.getDataLoader(mountId);
|
||||
if (dataLoader == null) {
|
||||
Slog.e(TAG, "Destroy failed to retrieve data loader for ID=" + mountId);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
dataLoader.destroy();
|
||||
} catch (RemoteException ex) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showHealthBlockedUI(int mountId) {
|
||||
// TODO(b/136132412): implement this
|
||||
}
|
||||
|
||||
private static native long nativeStartService();
|
||||
|
||||
private static native void nativeSystemReady(long nativeInstance);
|
||||
|
||||
private static native void nativeDump(long nativeInstance, int fd);
|
||||
}
|
||||
@@ -56,7 +56,6 @@ cc_library_static {
|
||||
"com_android_server_PersistentDataBlockService.cpp",
|
||||
"com_android_server_am_CachedAppOptimizer.cpp",
|
||||
"com_android_server_am_LowMemDetector.cpp",
|
||||
"com_android_server_incremental_IncrementalManagerService.cpp",
|
||||
"com_android_server_pm_PackageManagerShellCommandDataLoader.cpp",
|
||||
"onload.cpp",
|
||||
":lib_networkStatsFactory_native",
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include <binder/IServiceManager.h>
|
||||
#include <hidl/HidlTransportSupport.h>
|
||||
#include <incremental_service.h>
|
||||
|
||||
#include <schedulerservice/SchedulingPolicyService.h>
|
||||
#include <sensorservice/SensorService.h>
|
||||
@@ -132,18 +133,31 @@ static void android_server_SystemServer_spawnFdLeakCheckThread(JNIEnv*, jobject)
|
||||
}).detach();
|
||||
}
|
||||
|
||||
static jlong android_server_SystemServer_startIncrementalService(JNIEnv* env, jclass klass,
|
||||
jobject self) {
|
||||
return Incremental_IncrementalService_Start();
|
||||
}
|
||||
|
||||
static void android_server_SystemServer_setIncrementalServiceSystemReady(JNIEnv* env, jclass klass,
|
||||
jlong handle) {
|
||||
Incremental_IncrementalService_OnSystemReady(handle);
|
||||
}
|
||||
|
||||
/*
|
||||
* JNI registration.
|
||||
*/
|
||||
static const JNINativeMethod gMethods[] = {
|
||||
/* name, signature, funcPtr */
|
||||
{ "startSensorService", "()V", (void*) android_server_SystemServer_startSensorService },
|
||||
{ "startHidlServices", "()V", (void*) android_server_SystemServer_startHidlServices },
|
||||
{ "initZygoteChildHeapProfiling", "()V",
|
||||
(void*) android_server_SystemServer_initZygoteChildHeapProfiling },
|
||||
{ "spawnFdLeakCheckThread", "()V",
|
||||
(void*) android_server_SystemServer_spawnFdLeakCheckThread },
|
||||
|
||||
/* name, signature, funcPtr */
|
||||
{"startSensorService", "()V", (void*)android_server_SystemServer_startSensorService},
|
||||
{"startHidlServices", "()V", (void*)android_server_SystemServer_startHidlServices},
|
||||
{"initZygoteChildHeapProfiling", "()V",
|
||||
(void*)android_server_SystemServer_initZygoteChildHeapProfiling},
|
||||
{"spawnFdLeakCheckThread", "()V",
|
||||
(void*)android_server_SystemServer_spawnFdLeakCheckThread},
|
||||
{"startIncrementalService", "()J",
|
||||
(void*)android_server_SystemServer_startIncrementalService},
|
||||
{"setIncrementalServiceSystemReady", "(J)V",
|
||||
(void*)android_server_SystemServer_setIncrementalServiceSystemReady},
|
||||
};
|
||||
|
||||
int register_android_server_SystemServer(JNIEnv* env)
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 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.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "incremental_manager_service-jni"
|
||||
|
||||
#include "incremental_service.h"
|
||||
#include "jni.h"
|
||||
|
||||
#include <memory>
|
||||
#include <nativehelper/JNIHelp.h>
|
||||
|
||||
|
||||
namespace android {
|
||||
|
||||
static jlong nativeStartService(JNIEnv* env, jclass klass, jobject self) {
|
||||
return Incremental_IncrementalService_Start();
|
||||
}
|
||||
|
||||
static void nativeSystemReady(JNIEnv* env, jclass klass, jlong self) {
|
||||
Incremental_IncrementalService_OnSystemReady(self);
|
||||
}
|
||||
|
||||
static void nativeDump(JNIEnv* env, jclass klass, jlong self, jint fd) {
|
||||
Incremental_IncrementalService_OnDump(self, fd);
|
||||
}
|
||||
|
||||
static const JNINativeMethod method_table[] = {
|
||||
{"nativeStartService", "()J", (void*)nativeStartService},
|
||||
{"nativeSystemReady", "(J)V", (void*)nativeSystemReady},
|
||||
{"nativeDump", "(JI)V", (void*)nativeDump},
|
||||
};
|
||||
|
||||
int register_android_server_incremental_IncrementalManagerService(JNIEnv* env) {
|
||||
return jniRegisterNativeMethods(env,
|
||||
"com/android/server/incremental/IncrementalManagerService",
|
||||
method_table, std::size(method_table));
|
||||
}
|
||||
|
||||
} // namespace android
|
||||
@@ -58,7 +58,6 @@ int register_android_server_am_CachedAppOptimizer(JNIEnv* env);
|
||||
int register_android_server_am_LowMemDetector(JNIEnv* env);
|
||||
int register_com_android_server_soundtrigger_middleware_AudioSessionProviderImpl(
|
||||
JNIEnv* env);
|
||||
int register_android_server_incremental_IncrementalManagerService(JNIEnv* env);
|
||||
int register_android_server_com_android_server_pm_PackageManagerShellCommandDataLoader(JNIEnv* env);
|
||||
int register_android_server_stats_pull_StatsPullAtomService(JNIEnv* env);
|
||||
int register_android_server_AdbDebuggingManager(JNIEnv* env);
|
||||
@@ -113,7 +112,6 @@ extern "C" jint JNI_OnLoad(JavaVM* vm, void* /* reserved */)
|
||||
register_android_server_am_LowMemDetector(env);
|
||||
register_com_android_server_soundtrigger_middleware_AudioSessionProviderImpl(
|
||||
env);
|
||||
register_android_server_incremental_IncrementalManagerService(env);
|
||||
register_android_server_com_android_server_pm_PackageManagerShellCommandDataLoader(env);
|
||||
register_android_server_stats_pull_StatsPullAtomService(env);
|
||||
register_android_server_AdbDebuggingManager(env);
|
||||
|
||||
@@ -105,7 +105,6 @@ import com.android.server.emergency.EmergencyAffordanceService;
|
||||
import com.android.server.gpu.GpuService;
|
||||
import com.android.server.hdmi.HdmiControlService;
|
||||
import com.android.server.incident.IncidentCompanionService;
|
||||
import com.android.server.incremental.IncrementalManagerService;
|
||||
import com.android.server.input.InputManagerService;
|
||||
import com.android.server.inputmethod.InputMethodManagerService;
|
||||
import com.android.server.inputmethod.InputMethodSystemProperty;
|
||||
@@ -335,7 +334,7 @@ public final class SystemServer {
|
||||
private ContentResolver mContentResolver;
|
||||
private EntropyMixer mEntropyMixer;
|
||||
private DataLoaderManagerService mDataLoaderManagerService;
|
||||
private IncrementalManagerService mIncrementalManagerService;
|
||||
private long mIncrementalServiceHandle = 0;
|
||||
|
||||
private boolean mOnlyCore;
|
||||
private boolean mFirstBoot;
|
||||
@@ -377,6 +376,16 @@ public final class SystemServer {
|
||||
*/
|
||||
private static native void spawnFdLeakCheckThread();
|
||||
|
||||
/**
|
||||
* Start native Incremental Service and get its handle.
|
||||
*/
|
||||
private static native long startIncrementalService();
|
||||
|
||||
/**
|
||||
* Inform Incremental Service that system is ready.
|
||||
*/
|
||||
private static native void setIncrementalServiceSystemReady(long incrementalServiceHandle);
|
||||
|
||||
/**
|
||||
* The main entry point from zygote.
|
||||
*/
|
||||
@@ -745,8 +754,8 @@ public final class SystemServer {
|
||||
t.traceEnd();
|
||||
|
||||
// Incremental service needs to be started before package manager
|
||||
t.traceBegin("StartIncrementalManagerService");
|
||||
mIncrementalManagerService = IncrementalManagerService.start(mSystemContext);
|
||||
t.traceBegin("StartIncrementalService");
|
||||
mIncrementalServiceHandle = startIncrementalService();
|
||||
t.traceEnd();
|
||||
|
||||
// Power manager needs to be started early because other services need it.
|
||||
@@ -2133,9 +2142,9 @@ public final class SystemServer {
|
||||
mPackageManagerService.systemReady();
|
||||
t.traceEnd();
|
||||
|
||||
if (mIncrementalManagerService != null) {
|
||||
t.traceBegin("MakeIncrementalManagerServiceReady");
|
||||
mIncrementalManagerService.systemReady();
|
||||
if (mIncrementalServiceHandle != 0) {
|
||||
t.traceBegin("MakeIncrementalServiceReady");
|
||||
setIncrementalServiceSystemReady(mIncrementalServiceHandle);
|
||||
t.traceEnd();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user