Merge "Dynamic args complete removal." into rvc-dev am: a7b10f5623 am: 4604a9bbe7

Change-Id: I9984c6633ab8eadc274c8df8268f374c555f75ee
This commit is contained in:
Yurii Zubrytskyi
2020-03-27 08:02:39 +00:00
committed by Automerger Merge Worker
7 changed files with 4 additions and 64 deletions

View File

@@ -952,7 +952,6 @@ filegroup {
"core/java/android/content/pm/InstallationFileLocation.aidl", "core/java/android/content/pm/InstallationFileLocation.aidl",
"core/java/android/content/pm/IDataLoaderStatusListener.aidl", "core/java/android/content/pm/IDataLoaderStatusListener.aidl",
"core/java/android/content/pm/IPackageInstallerSessionFileSystemConnector.aidl", "core/java/android/content/pm/IPackageInstallerSessionFileSystemConnector.aidl",
"core/java/android/content/pm/NamedParcelFileDescriptor.aidl",
], ],
path: "core/java", path: "core/java",
} }

View File

@@ -17,12 +17,8 @@
package android.content.pm; package android.content.pm;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi; import android.annotation.SystemApi;
import android.content.ComponentName; import android.content.ComponentName;
import android.os.ParcelFileDescriptor;
import java.util.Map;
/** /**
* This class represents the parameters used to configure a Data Loader. * This class represents the parameters used to configure a Data Loader.
@@ -44,7 +40,7 @@ public class DataLoaderParams {
*/ */
public static final @NonNull DataLoaderParams forStreaming(@NonNull ComponentName componentName, public static final @NonNull DataLoaderParams forStreaming(@NonNull ComponentName componentName,
@NonNull String arguments) { @NonNull String arguments) {
return new DataLoaderParams(DataLoaderType.STREAMING, componentName, arguments, null); return new DataLoaderParams(DataLoaderType.STREAMING, componentName, arguments);
} }
/** /**
@@ -55,29 +51,17 @@ public class DataLoaderParams {
*/ */
public static final @NonNull DataLoaderParams forIncremental( public static final @NonNull DataLoaderParams forIncremental(
@NonNull ComponentName componentName, @NonNull String arguments) { @NonNull ComponentName componentName, @NonNull String arguments) {
return new DataLoaderParams(DataLoaderType.INCREMENTAL, componentName, arguments, null); return new DataLoaderParams(DataLoaderType.INCREMENTAL, componentName, arguments);
} }
/** @hide */ /** @hide */
public DataLoaderParams(@NonNull @DataLoaderType int type, @NonNull ComponentName componentName, public DataLoaderParams(@NonNull @DataLoaderType int type, @NonNull ComponentName componentName,
@NonNull String arguments, @Nullable Map<String, ParcelFileDescriptor> namedFds) { @NonNull String arguments) {
DataLoaderParamsParcel data = new DataLoaderParamsParcel(); DataLoaderParamsParcel data = new DataLoaderParamsParcel();
data.type = type; data.type = type;
data.packageName = componentName.getPackageName(); data.packageName = componentName.getPackageName();
data.className = componentName.getClassName(); data.className = componentName.getClassName();
data.arguments = arguments; data.arguments = arguments;
if (namedFds == null || namedFds.isEmpty()) {
data.dynamicArgs = new NamedParcelFileDescriptor[0];
} else {
data.dynamicArgs = new NamedParcelFileDescriptor[namedFds.size()];
int i = 0;
for (Map.Entry<String, ParcelFileDescriptor> namedFd : namedFds.entrySet()) {
data.dynamicArgs[i] = new NamedParcelFileDescriptor();
data.dynamicArgs[i].name = namedFd.getKey();
data.dynamicArgs[i].fd = namedFd.getValue();
i += 1;
}
}
mData = data; mData = data;
} }

View File

@@ -17,7 +17,6 @@
package android.content.pm; package android.content.pm;
import android.content.pm.DataLoaderType; import android.content.pm.DataLoaderType;
import android.content.pm.NamedParcelFileDescriptor;
/** /**
* Class for holding data loader configuration parameters. * Class for holding data loader configuration parameters.
@@ -28,5 +27,4 @@ parcelable DataLoaderParamsParcel {
@utf8InCpp String packageName; @utf8InCpp String packageName;
@utf8InCpp String className; @utf8InCpp String className;
@utf8InCpp String arguments; @utf8InCpp String arguments;
NamedParcelFileDescriptor[] dynamicArgs;
} }

View File

@@ -1,28 +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.content.pm;
import android.os.ParcelFileDescriptor;
/**
* A named ParcelFileDescriptor.
* @hide
*/
parcelable NamedParcelFileDescriptor {
@utf8InCpp String name;
ParcelFileDescriptor fd;
}

View File

@@ -29,7 +29,6 @@ import android.content.pm.IDataLoader;
import android.content.pm.IDataLoaderStatusListener; import android.content.pm.IDataLoaderStatusListener;
import android.content.pm.InstallationFile; import android.content.pm.InstallationFile;
import android.content.pm.InstallationFileParcel; import android.content.pm.InstallationFileParcel;
import android.content.pm.NamedParcelFileDescriptor;
import android.os.IBinder; import android.os.IBinder;
import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor;
import android.util.ExceptionUtils; import android.util.ExceptionUtils;
@@ -133,16 +132,6 @@ public abstract class DataLoaderService extends Service {
} }
} }
} }
if (params.dynamicArgs != null) {
NamedParcelFileDescriptor[] fds = params.dynamicArgs;
for (NamedParcelFileDescriptor nfd : fds) {
try {
nfd.fd.close();
} catch (IOException e) {
Slog.e(TAG, "Failed to close DynamicArgs parcel file descriptor " + e);
}
}
}
} }
} }

View File

@@ -3245,8 +3245,7 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub {
new ComponentName( new ComponentName(
readStringAttribute(in, ATTR_DATALOADER_PACKAGE_NAME), readStringAttribute(in, ATTR_DATALOADER_PACKAGE_NAME),
readStringAttribute(in, ATTR_DATALOADER_CLASS_NAME)), readStringAttribute(in, ATTR_DATALOADER_CLASS_NAME)),
readStringAttribute(in, ATTR_DATALOADER_ARGUMENTS), readStringAttribute(in, ATTR_DATALOADER_ARGUMENTS));
null);
} }
final File appIconFile = buildAppIconFile(sessionId, sessionsDir); final File appIconFile = buildAppIconFile(sessionId, sessionsDir);

View File

@@ -285,7 +285,6 @@ void IncrementalService::onDump(int fd) {
dprintf(fd, "\t\t\tpackageName: %s\n", params.packageName.c_str()); dprintf(fd, "\t\t\tpackageName: %s\n", params.packageName.c_str());
dprintf(fd, "\t\t\tclassName: %s\n", params.className.c_str()); dprintf(fd, "\t\t\tclassName: %s\n", params.className.c_str());
dprintf(fd, "\t\t\targuments: %s\n", params.arguments.c_str()); dprintf(fd, "\t\t\targuments: %s\n", params.arguments.c_str());
dprintf(fd, "\t\t\tdynamicArgs: %d\n", int(params.dynamicArgs.size()));
} }
dprintf(fd, "\t\tstorages (%d):\n", int(mnt.storages.size())); dprintf(fd, "\t\tstorages (%d):\n", int(mnt.storages.size()));
for (auto&& [storageId, storage] : mnt.storages) { for (auto&& [storageId, storage] : mnt.storages) {