am 2def6148: Merge "Hiding some unneeded APIs," into klp-dev

* commit '2def61485413084e68233c89ba956a2282fbacd1':
  Hiding some unneeded APIs,
This commit is contained in:
Svetoslav
2013-09-05 10:03:47 -07:00
committed by Android Git Automerger
3 changed files with 21 additions and 34 deletions

View File

@@ -19027,7 +19027,6 @@ package android.print {
}
public static final class PrintAttributes.MediaSize {
ctor public PrintAttributes.MediaSize(java.lang.String, java.lang.String, int, int, int);
ctor public PrintAttributes.MediaSize(java.lang.String, java.lang.String, int, int);
method public android.print.PrintAttributes.MediaSize asLandscape();
method public android.print.PrintAttributes.MediaSize asPortrait();
@@ -19078,7 +19077,6 @@ package android.print {
}
public static final class PrintAttributes.Resolution {
ctor public PrintAttributes.Resolution(java.lang.String, java.lang.String, int, int, int);
ctor public PrintAttributes.Resolution(java.lang.String, java.lang.String, int, int);
method public int getHorizontalDpi();
method public java.lang.String getId();

View File

@@ -412,6 +412,8 @@ public final class PrintAttributes implements Parcelable {
* @throws IllegalArgumentException If the label is empty.
* @throws IllegalArgumentException If the widthMils is less than or equal to zero.
* @throws IllegalArgumentException If the heightMils is less than or equal to zero.
*
* @hide
*/
public MediaSize(String id, String packageName, int labelResId,
int widthMils, int heightMils) {
@@ -441,8 +443,7 @@ public final class PrintAttributes implements Parcelable {
}
/**
* Creates a new instance. You should use this constructor as a fallback
* in cases when you do not have a localized string for the label.
* Creates a new instance.
*
* @param id The unique media size id.
* @param label The <strong>internationalized</strong> human readable label.
@@ -550,32 +551,28 @@ public final class PrintAttributes implements Parcelable {
/**
* Returns a new media size in a portrait orientation
* which is the height is the lesser dimension.
* which is the height is the greater dimension.
*
* @return New instance in landscape orientation.
*/
public MediaSize asPortrait() {
if (!TextUtils.isEmpty(mPackageName) && mLabelResId > 0) {
return new MediaSize(mId, mPackageName, mLabelResId,
Math.min(mWidthMils, mHeightMils),
Math.max(mWidthMils, mHeightMils));
} else {
return new MediaSize(mId, mLabel,
Math.min(mWidthMils, mHeightMils),
Math.max(mWidthMils, mHeightMils));
}
return new MediaSize(mId, mPackageName, mLabel,
Math.min(mWidthMils, mHeightMils),
Math.max(mWidthMils, mHeightMils),
mLabelResId);
}
/**
* Returns a new media size in a landscape orientation
* which is the height is the greater dimension.
* which is the height is the lesser dimension.
*
* @return New instance in landscape orientation.
*/
public MediaSize asLandscape() {
return new MediaSize(mId, mLabel,
Math.max(mWidthMils, mHeightMils),
Math.min(mWidthMils, mHeightMils));
Math.min(mWidthMils, mHeightMils),
mLabelResId);
}
void writeToParcel(Parcel parcel) {
@@ -601,7 +598,6 @@ public final class PrintAttributes implements Parcelable {
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((mId == null) ? 0 : mId.hashCode());
result = prime * result + mWidthMils;
result = prime * result + mHeightMils;
return result;
@@ -619,9 +615,6 @@ public final class PrintAttributes implements Parcelable {
return false;
}
MediaSize other = (MediaSize) obj;
if (!TextUtils.equals(mId, other.mId)) {
return false;
}
if (mWidthMils != other.mWidthMils) {
return false;
}
@@ -677,6 +670,8 @@ public final class PrintAttributes implements Parcelable {
* @throws IllegalArgumentException If the label is empty.
* @throws IllegalArgumentException If the horizontalDpi is less than or equal to zero.
* @throws IllegalArgumentException If the verticalDpi is less than or equal to zero.
*
* @hide
*/
public Resolution(String id, String packageName, int labelResId,
int horizontalDpi, int verticalDpi) {
@@ -706,8 +701,7 @@ public final class PrintAttributes implements Parcelable {
}
/**
* Creates a new instance. You should use this constructor as a fallback
* in cases when you do not have a localized string for the label.
* Creates a new instance.
*
* @param id The unique resolution id.
* @param label The <strong>internationalized</strong> human readable label.
@@ -825,7 +819,6 @@ public final class PrintAttributes implements Parcelable {
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((mId == null) ? 0 : mId.hashCode());
result = prime * result + mHorizontalDpi;
result = prime * result + mVerticalDpi;
return result;
@@ -843,9 +836,6 @@ public final class PrintAttributes implements Parcelable {
return false;
}
Resolution other = (Resolution) obj;
if (!TextUtils.equals(mId, other.mId)) {
return false;
}
if (mHorizontalDpi != other.mHorizontalDpi) {
return false;
}

View File

@@ -41,6 +41,7 @@ import android.print.PrintJobInfo;
import android.print.PrintManager;
import android.print.PrinterId;
import android.print.PrinterInfo;
import android.text.TextUtils;
import android.util.AtomicFile;
import android.util.Log;
import android.util.Slog;
@@ -814,10 +815,9 @@ public final class PrintSpoolerService extends Service {
mediaSize.getWidthMils()));
serializer.attribute(null, ATTR_HEIGHT_MILS, String.valueOf(
mediaSize.getHeightMils()));
// Store only the platform localized versions of the label
// since the resource ids for a print service are not stable
// across application versions.
if ("android".equals(mediaSize.mPackageName)
// We prefer to store only the package name and
// resource id and fallback to the label.
if (!TextUtils.isEmpty(mediaSize.mPackageName)
&& mediaSize.mLabelResId > 0) {
serializer.attribute(null, ATTR_PACKAGE_NAME,
mediaSize.mPackageName);
@@ -838,10 +838,9 @@ public final class PrintSpoolerService extends Service {
resolution.getHorizontalDpi()));
serializer.attribute(null, ATTR_VERTICAL_DPI, String.valueOf(
resolution.getVerticalDpi()));
// Store only the platform localized versions of the label
// since the resource ids for a print service are not stable
// across application versions.
if ("android".equals(resolution.mPackageName)
// We prefer to store only the package name and
// resource id and fallback to the label.
if (!TextUtils.isEmpty(mediaSize.mPackageName)
&& resolution.mLabelResId > 0) {
serializer.attribute(null, ATTR_PACKAGE_NAME,
resolution.mPackageName);