Merge "Dynamic args complete removal." into rvc-dev

This commit is contained in:
Yurii Zubrytskyi
2020-03-27 07:23:55 +00:00
committed by Android (Google) Code Review
7 changed files with 4 additions and 64 deletions

View File

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

View File

@@ -17,12 +17,8 @@
package android.content.pm;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.content.ComponentName;
import android.os.ParcelFileDescriptor;
import java.util.Map;
/**
* 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,
@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(
@NonNull ComponentName componentName, @NonNull String arguments) {
return new DataLoaderParams(DataLoaderType.INCREMENTAL, componentName, arguments, null);
return new DataLoaderParams(DataLoaderType.INCREMENTAL, componentName, arguments);
}
/** @hide */
public DataLoaderParams(@NonNull @DataLoaderType int type, @NonNull ComponentName componentName,
@NonNull String arguments, @Nullable Map<String, ParcelFileDescriptor> namedFds) {
@NonNull String arguments) {
DataLoaderParamsParcel data = new DataLoaderParamsParcel();
data.type = type;
data.packageName = componentName.getPackageName();
data.className = componentName.getClassName();
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;
}

View File

@@ -17,7 +17,6 @@
package android.content.pm;
import android.content.pm.DataLoaderType;
import android.content.pm.NamedParcelFileDescriptor;
/**
* Class for holding data loader configuration parameters.
@@ -28,5 +27,4 @@ parcelable DataLoaderParamsParcel {
@utf8InCpp String packageName;
@utf8InCpp String className;
@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.InstallationFile;
import android.content.pm.InstallationFileParcel;
import android.content.pm.NamedParcelFileDescriptor;
import android.os.IBinder;
import android.os.ParcelFileDescriptor;
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(
readStringAttribute(in, ATTR_DATALOADER_PACKAGE_NAME),
readStringAttribute(in, ATTR_DATALOADER_CLASS_NAME)),
readStringAttribute(in, ATTR_DATALOADER_ARGUMENTS),
null);
readStringAttribute(in, ATTR_DATALOADER_ARGUMENTS));
}
final File appIconFile = buildAppIconFile(sessionId, sessionsDir);

View File

@@ -286,7 +286,6 @@ void IncrementalService::onDump(int fd) {
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\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()));
for (auto&& [storageId, storage] : mnt.storages) {