Dynamic args complete removal.
Bug: b/150470163 Test: atest PackageManagerShellCommandIncrementalTest PackageManagerShellCommandTest Change-Id: I122f37f210ef9b8b02d565c34245ebeec26d83b2
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user