Loading core/java/android/content/pm/PackageInfo.java +1 −1 Original line number Diff line number Diff line Loading @@ -151,7 +151,7 @@ public class PackageInfo implements Parcelable { */ public static final int INSTALL_LOCATION_PREFER_EXTERNAL = 2; /** * The launch mode style requested by the activity. From the * The install location requested by the activity. From the * {@link android.R.attr#installLocation} attribute, one of * {@link #INSTALL_LOCATION_AUTO}, * {@link #INSTALL_LOCATION_INTERNAL_ONLY}, Loading core/java/android/content/pm/PackageInfoLite.aidl 0 → 100755 +20 −0 Original line number Diff line number Diff line /* //device/java/android/android/view/WindowManager.aidl ** ** Copyright 2007, 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; parcelable PackageInfoLite; core/java/android/content/pm/PackageInfoLite.java 0 → 100644 +63 −0 Original line number Diff line number Diff line package android.content.pm; import android.os.Parcel; import android.os.Parcelable; /** * Basic information about a package as specified in its manifest. * Utility class used in PackageManager methods * @hide */ public class PackageInfoLite implements Parcelable { /** * The name of this package. From the <manifest> tag's "name" * attribute. */ public String packageName; /** * Specifies the recommended install location. Can be one of * {@link #PackageHelper.RECOMMEND_INSTALL_INTERNAL} to install on internal storage * {@link #PackageHelper.RECOMMEND_INSTALL_EXTERNAL} to install on external media * {@link PackageHelper.RECOMMEND_FAILED_INSUFFICIENT_STORAGE} for storage errors * {@link PackageHelper.RECOMMEND_FAILED_INVALID_APK} for parse errors. */ public int recommendedInstallLocation; public int installLocation; public PackageInfoLite() { } public String toString() { return "PackageInfoLite{" + Integer.toHexString(System.identityHashCode(this)) + " " + packageName + "}"; } public int describeContents() { return 0; } public void writeToParcel(Parcel dest, int parcelableFlags) { dest.writeString(packageName); dest.writeInt(recommendedInstallLocation); dest.writeInt(installLocation); } public static final Parcelable.Creator<PackageInfoLite> CREATOR = new Parcelable.Creator<PackageInfoLite>() { public PackageInfoLite createFromParcel(Parcel source) { return new PackageInfoLite(source); } public PackageInfoLite[] newArray(int size) { return new PackageInfoLite[size]; } }; private PackageInfoLite(Parcel source) { packageName = source.readString(); recommendedInstallLocation = source.readInt(); installLocation = source.readInt(); } } No newline at end of file core/java/android/content/pm/PackageParser.java +70 −7 Original line number Diff line number Diff line Loading @@ -137,6 +137,19 @@ public class PackageParser { } } /* Light weight package info. * @hide */ public static class PackageLite { public String packageName; public int installLocation; public String mScanPath; public PackageLite(String packageName, int installLocation) { this.packageName = packageName; this.installLocation = installLocation; } } private ParsePackageItemArgs mParseInstrumentationArgs; private ParseComponentArgs mParseActivityArgs; private ParseComponentArgs mParseActivityAliasArgs; Loading Loading @@ -562,7 +575,14 @@ public class PackageParser { return true; } public static String parsePackageName(String packageFilePath, int flags) { /* * Utility method that retrieves just the package name and install * location from the apk location at the given file path. * @param packageFilePath file location of the apk * @param flags Special parse flags * @return PackageLite object with package information. */ public static PackageLite parsePackageLite(String packageFilePath, int flags) { XmlResourceParser parser = null; AssetManager assmgr = null; try { Loading @@ -577,9 +597,9 @@ public class PackageParser { } AttributeSet attrs = parser; String errors[] = new String[1]; String packageName = null; PackageLite packageLite = null; try { packageName = parsePackageName(parser, attrs, flags, errors); packageLite = parsePackageLite(parser, attrs, flags, errors); } catch (IOException e) { Log.w(TAG, packageFilePath, e); } catch (XmlPullParserException e) { Loading @@ -588,11 +608,11 @@ public class PackageParser { if (parser != null) parser.close(); if (assmgr != null) assmgr.close(); } if (packageName == null) { Log.e(TAG, "parsePackageName error: " + errors[0]); if (packageLite == null) { Log.e(TAG, "parsePackageLite error: " + errors[0]); return null; } return packageName; return packageLite; } private static String validateName(String name, boolean requiresSeparator) { Loading Loading @@ -656,6 +676,49 @@ public class PackageParser { return pkgName.intern(); } private static PackageLite parsePackageLite(XmlPullParser parser, AttributeSet attrs, int flags, String[] outError) throws IOException, XmlPullParserException { int type; while ((type=parser.next()) != parser.START_TAG && type != parser.END_DOCUMENT) { ; } if (type != parser.START_TAG) { outError[0] = "No start tag found"; return null; } if ((flags&PARSE_CHATTY) != 0 && Config.LOGV) Log.v( TAG, "Root element name: '" + parser.getName() + "'"); if (!parser.getName().equals("manifest")) { outError[0] = "No <manifest> tag"; return null; } String pkgName = attrs.getAttributeValue(null, "package"); if (pkgName == null || pkgName.length() == 0) { outError[0] = "<manifest> does not specify package"; return null; } String nameError = validateName(pkgName, true); if (nameError != null && !"android".equals(pkgName)) { outError[0] = "<manifest> specifies bad package name \"" + pkgName + "\": " + nameError; return null; } int installLocation = PackageInfo.INSTALL_LOCATION_AUTO; for (int i = 0; i < attrs.getAttributeCount(); i++) { String attr = attrs.getAttributeName(i); if (attr.equals("installLocation")) { installLocation = attrs.getAttributeIntValue(i, PackageInfo.INSTALL_LOCATION_AUTO); break; } } return new PackageLite(pkgName.intern(), installLocation); } /** * Temporary. */ Loading core/java/com/android/internal/app/IMediaContainerService.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.internal.app; import android.net.Uri; import android.os.ParcelFileDescriptor; import android.content.pm.PackageInfoLite; interface IMediaContainerService { String copyResourceToContainer(in Uri packageURI, Loading @@ -25,5 +26,5 @@ interface IMediaContainerService { String key, String resFileName); boolean copyResource(in Uri packageURI, in ParcelFileDescriptor outStream); int getRecommendedInstallLocation(in Uri fileUri); PackageInfoLite getMinimalPackageInfo(in Uri fileUri); } No newline at end of file Loading
core/java/android/content/pm/PackageInfo.java +1 −1 Original line number Diff line number Diff line Loading @@ -151,7 +151,7 @@ public class PackageInfo implements Parcelable { */ public static final int INSTALL_LOCATION_PREFER_EXTERNAL = 2; /** * The launch mode style requested by the activity. From the * The install location requested by the activity. From the * {@link android.R.attr#installLocation} attribute, one of * {@link #INSTALL_LOCATION_AUTO}, * {@link #INSTALL_LOCATION_INTERNAL_ONLY}, Loading
core/java/android/content/pm/PackageInfoLite.aidl 0 → 100755 +20 −0 Original line number Diff line number Diff line /* //device/java/android/android/view/WindowManager.aidl ** ** Copyright 2007, 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; parcelable PackageInfoLite;
core/java/android/content/pm/PackageInfoLite.java 0 → 100644 +63 −0 Original line number Diff line number Diff line package android.content.pm; import android.os.Parcel; import android.os.Parcelable; /** * Basic information about a package as specified in its manifest. * Utility class used in PackageManager methods * @hide */ public class PackageInfoLite implements Parcelable { /** * The name of this package. From the <manifest> tag's "name" * attribute. */ public String packageName; /** * Specifies the recommended install location. Can be one of * {@link #PackageHelper.RECOMMEND_INSTALL_INTERNAL} to install on internal storage * {@link #PackageHelper.RECOMMEND_INSTALL_EXTERNAL} to install on external media * {@link PackageHelper.RECOMMEND_FAILED_INSUFFICIENT_STORAGE} for storage errors * {@link PackageHelper.RECOMMEND_FAILED_INVALID_APK} for parse errors. */ public int recommendedInstallLocation; public int installLocation; public PackageInfoLite() { } public String toString() { return "PackageInfoLite{" + Integer.toHexString(System.identityHashCode(this)) + " " + packageName + "}"; } public int describeContents() { return 0; } public void writeToParcel(Parcel dest, int parcelableFlags) { dest.writeString(packageName); dest.writeInt(recommendedInstallLocation); dest.writeInt(installLocation); } public static final Parcelable.Creator<PackageInfoLite> CREATOR = new Parcelable.Creator<PackageInfoLite>() { public PackageInfoLite createFromParcel(Parcel source) { return new PackageInfoLite(source); } public PackageInfoLite[] newArray(int size) { return new PackageInfoLite[size]; } }; private PackageInfoLite(Parcel source) { packageName = source.readString(); recommendedInstallLocation = source.readInt(); installLocation = source.readInt(); } } No newline at end of file
core/java/android/content/pm/PackageParser.java +70 −7 Original line number Diff line number Diff line Loading @@ -137,6 +137,19 @@ public class PackageParser { } } /* Light weight package info. * @hide */ public static class PackageLite { public String packageName; public int installLocation; public String mScanPath; public PackageLite(String packageName, int installLocation) { this.packageName = packageName; this.installLocation = installLocation; } } private ParsePackageItemArgs mParseInstrumentationArgs; private ParseComponentArgs mParseActivityArgs; private ParseComponentArgs mParseActivityAliasArgs; Loading Loading @@ -562,7 +575,14 @@ public class PackageParser { return true; } public static String parsePackageName(String packageFilePath, int flags) { /* * Utility method that retrieves just the package name and install * location from the apk location at the given file path. * @param packageFilePath file location of the apk * @param flags Special parse flags * @return PackageLite object with package information. */ public static PackageLite parsePackageLite(String packageFilePath, int flags) { XmlResourceParser parser = null; AssetManager assmgr = null; try { Loading @@ -577,9 +597,9 @@ public class PackageParser { } AttributeSet attrs = parser; String errors[] = new String[1]; String packageName = null; PackageLite packageLite = null; try { packageName = parsePackageName(parser, attrs, flags, errors); packageLite = parsePackageLite(parser, attrs, flags, errors); } catch (IOException e) { Log.w(TAG, packageFilePath, e); } catch (XmlPullParserException e) { Loading @@ -588,11 +608,11 @@ public class PackageParser { if (parser != null) parser.close(); if (assmgr != null) assmgr.close(); } if (packageName == null) { Log.e(TAG, "parsePackageName error: " + errors[0]); if (packageLite == null) { Log.e(TAG, "parsePackageLite error: " + errors[0]); return null; } return packageName; return packageLite; } private static String validateName(String name, boolean requiresSeparator) { Loading Loading @@ -656,6 +676,49 @@ public class PackageParser { return pkgName.intern(); } private static PackageLite parsePackageLite(XmlPullParser parser, AttributeSet attrs, int flags, String[] outError) throws IOException, XmlPullParserException { int type; while ((type=parser.next()) != parser.START_TAG && type != parser.END_DOCUMENT) { ; } if (type != parser.START_TAG) { outError[0] = "No start tag found"; return null; } if ((flags&PARSE_CHATTY) != 0 && Config.LOGV) Log.v( TAG, "Root element name: '" + parser.getName() + "'"); if (!parser.getName().equals("manifest")) { outError[0] = "No <manifest> tag"; return null; } String pkgName = attrs.getAttributeValue(null, "package"); if (pkgName == null || pkgName.length() == 0) { outError[0] = "<manifest> does not specify package"; return null; } String nameError = validateName(pkgName, true); if (nameError != null && !"android".equals(pkgName)) { outError[0] = "<manifest> specifies bad package name \"" + pkgName + "\": " + nameError; return null; } int installLocation = PackageInfo.INSTALL_LOCATION_AUTO; for (int i = 0; i < attrs.getAttributeCount(); i++) { String attr = attrs.getAttributeName(i); if (attr.equals("installLocation")) { installLocation = attrs.getAttributeIntValue(i, PackageInfo.INSTALL_LOCATION_AUTO); break; } } return new PackageLite(pkgName.intern(), installLocation); } /** * Temporary. */ Loading
core/java/com/android/internal/app/IMediaContainerService.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.internal.app; import android.net.Uri; import android.os.ParcelFileDescriptor; import android.content.pm.PackageInfoLite; interface IMediaContainerService { String copyResourceToContainer(in Uri packageURI, Loading @@ -25,5 +26,5 @@ interface IMediaContainerService { String key, String resFileName); boolean copyResource(in Uri packageURI, in ParcelFileDescriptor outStream); int getRecommendedInstallLocation(in Uri fileUri); PackageInfoLite getMinimalPackageInfo(in Uri fileUri); } No newline at end of file