Skip to content

Commit

Permalink
update miui of [ics]
Browse files Browse the repository at this point in the history
Change-Id: I29cf945ecf75aaa8ba7d40f5a7922038c63b9019
  • Loading branch information
yu88my committed Nov 23, 2012
1 parent 3259b71 commit bfdb8a7
Show file tree
Hide file tree
Showing 14,222 changed files with 692,898 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
1,191 changes: 1,191 additions & 0 deletions src/frameworks/base/cmds/pm/src/com/android/commands/pm/Pm.java

Large diffs are not rendered by default.

2,263 changes: 2,263 additions & 0 deletions src/frameworks/base/core/java/android/accounts/AccountManagerService.java

Large diffs are not rendered by default.

4,663 changes: 4,663 additions & 0 deletions src/frameworks/base/core/java/android/app/Activity.java

Large diffs are not rendered by default.

1,579 changes: 1,579 additions & 0 deletions src/frameworks/base/core/java/android/app/ActivityManager.java

Large diffs are not rendered by default.

4,441 changes: 4,441 additions & 0 deletions src/frameworks/base/core/java/android/app/ActivityThread.java

Large diffs are not rendered by default.

1,245 changes: 1,245 additions & 0 deletions src/frameworks/base/core/java/android/app/ApplicationPackageManager.java

Large diffs are not rendered by default.

1,649 changes: 1,649 additions & 0 deletions src/frameworks/base/core/java/android/app/ContextImpl.java

Large diffs are not rendered by default.

1,366 changes: 1,366 additions & 0 deletions src/frameworks/base/core/java/android/app/DownloadManager.java

Large diffs are not rendered by default.

1,115 changes: 1,115 additions & 0 deletions src/frameworks/base/core/java/android/app/LoadedApk.java

Large diffs are not rendered by default.

670 changes: 670 additions & 0 deletions src/frameworks/base/core/java/android/content/pm/ApplicationInfo.java

Large diffs are not rendered by default.

291 changes: 291 additions & 0 deletions src/frameworks/base/core/java/android/content/pm/PackageItemInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,291 @@
/*
* Copyright (C) 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;

import android.annotation.MiuiHook;
import android.annotation.MiuiHook.MiuiHookType;
import android.content.res.XmlResourceParser;

import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Parcel;
import android.text.TextUtils;
import android.util.Printer;

import java.text.Collator;
import java.util.Comparator;

/**
* Base class containing information common to all package items held by
* the package manager. This provides a very common basic set of attributes:
* a label, icon, and meta-data. This class is not intended
* to be used by itself; it is simply here to share common definitions
* between all items returned by the package manager. As such, it does not
* itself implement Parcelable, but does provide convenience methods to assist
* in the implementation of Parcelable in subclasses.
*/
public class PackageItemInfo {
/**
* Public name of this item. From the "android:name" attribute.
*/
public String name;

/**
* Name of the package that this item is in.
*/
public String packageName;

/**
* A string resource identifier (in the package's resources) of this
* component's label. From the "label" attribute or, if not set, 0.
*/
public int labelRes;

/**
* The string provided in the AndroidManifest file, if any. You
* probably don't want to use this. You probably want
* {@link PackageManager#getApplicationLabel}
*/
public CharSequence nonLocalizedLabel;

/**
* A drawable resource identifier (in the package's resources) of this
* component's icon. From the "icon" attribute or, if not set, 0.
*/
public int icon;

/**
* A drawable resource identifier (in the package's resources) of this
* component's logo. Logos may be larger/wider than icons and are
* displayed by certain UI elements in place of a name or name/icon
* combination. From the "logo" attribute or, if not set, 0.
*/
public int logo;

/**
* Additional meta-data associated with this component. This field
* will only be filled in if you set the
* {@link PackageManager#GET_META_DATA} flag when requesting the info.
*/
public Bundle metaData;

public PackageItemInfo() {
}

public PackageItemInfo(PackageItemInfo orig) {
name = orig.name;
if (name != null) name = name.trim();
packageName = orig.packageName;
labelRes = orig.labelRes;
nonLocalizedLabel = orig.nonLocalizedLabel;
if (nonLocalizedLabel != null) nonLocalizedLabel = nonLocalizedLabel.toString().trim();
icon = orig.icon;
logo = orig.logo;
metaData = orig.metaData;
}

/**
* Retrieve the current textual label associated with this item. This
* will call back on the given PackageManager to load the label from
* the application.
*
* @param pm A PackageManager from which the label can be loaded; usually
* the PackageManager from which you originally retrieved this item.
*
* @return Returns a CharSequence containing the item's label. If the
* item does not have a label, its name is returned.
*/
public CharSequence loadLabel(PackageManager pm) {
if (nonLocalizedLabel != null) {
return nonLocalizedLabel;
}
if (labelRes != 0) {
CharSequence label = pm.getText(packageName, labelRes, getApplicationInfo());
if (label != null) {
return label.toString().trim();
}
}
if (name != null) {
return name;
}
return packageName;
}

/**
* Retrieve the current graphical icon associated with this item. This
* will call back on the given PackageManager to load the icon from
* the application.
*
* @param pm A PackageManager from which the icon can be loaded; usually
* the PackageManager from which you originally retrieved this item.
*
* @return Returns a Drawable containing the item's icon. If the
* item does not have an icon, the item's default icon is returned
* such as the default activity icon.
*/
@MiuiHook(MiuiHookType.CHANGE_CODE)
public Drawable loadIcon(PackageManager pm) {
if (icon != 0) {
Drawable dr = android.app.MiuiThemeHelper.getDrawable(pm, packageName, icon, getApplicationInfo(), name); // MIUIHOOK
if (dr != null) {
return dr;
}
}
return loadDefaultIcon(pm);
}

/**
* Retrieve the default graphical icon associated with this item.
*
* @param pm A PackageManager from which the icon can be loaded; usually
* the PackageManager from which you originally retrieved this item.
*
* @return Returns a Drawable containing the item's default icon
* such as the default activity icon.
*
* @hide
*/
protected Drawable loadDefaultIcon(PackageManager pm) {
return pm.getDefaultActivityIcon();
}

/**
* Retrieve the current graphical logo associated with this item. This
* will call back on the given PackageManager to load the logo from
* the application.
*
* @param pm A PackageManager from which the logo can be loaded; usually
* the PackageManager from which you originally retrieved this item.
*
* @return Returns a Drawable containing the item's logo. If the item
* does not have a logo, this method will return null.
*/
public Drawable loadLogo(PackageManager pm) {
if (logo != 0) {
Drawable d = pm.getDrawable(packageName, logo, getApplicationInfo());
if (d != null) {
return d;
}
}
return loadDefaultLogo(pm);
}

/**
* Retrieve the default graphical logo associated with this item.
*
* @param pm A PackageManager from which the logo can be loaded; usually
* the PackageManager from which you originally retrieved this item.
*
* @return Returns a Drawable containing the item's default logo
* or null if no default logo is available.
*
* @hide
*/
protected Drawable loadDefaultLogo(PackageManager pm) {
return null;
}

/**
* Load an XML resource attached to the meta-data of this item. This will
* retrieved the name meta-data entry, and if defined call back on the
* given PackageManager to load its XML file from the application.
*
* @param pm A PackageManager from which the XML can be loaded; usually
* the PackageManager from which you originally retrieved this item.
* @param name Name of the meta-date you would like to load.
*
* @return Returns an XmlPullParser you can use to parse the XML file
* assigned as the given meta-data. If the meta-data name is not defined
* or the XML resource could not be found, null is returned.
*/
public XmlResourceParser loadXmlMetaData(PackageManager pm, String name) {
if (metaData != null) {
int resid = metaData.getInt(name);
if (resid != 0) {
return pm.getXml(packageName, resid, getApplicationInfo());
}
}
return null;
}

protected void dumpFront(Printer pw, String prefix) {
if (name != null) {
pw.println(prefix + "name=" + name);
}
pw.println(prefix + "packageName=" + packageName);
if (labelRes != 0 || nonLocalizedLabel != null || icon != 0) {
pw.println(prefix + "labelRes=0x" + Integer.toHexString(labelRes)
+ " nonLocalizedLabel=" + nonLocalizedLabel
+ " icon=0x" + Integer.toHexString(icon));
}
}

protected void dumpBack(Printer pw, String prefix) {
// no back here
}

public void writeToParcel(Parcel dest, int parcelableFlags) {
dest.writeString(name);
dest.writeString(packageName);
dest.writeInt(labelRes);
TextUtils.writeToParcel(nonLocalizedLabel, dest, parcelableFlags);
dest.writeInt(icon);
dest.writeInt(logo);
dest.writeBundle(metaData);
}

protected PackageItemInfo(Parcel source) {
name = source.readString();
packageName = source.readString();
labelRes = source.readInt();
nonLocalizedLabel
= TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source);
icon = source.readInt();
logo = source.readInt();
metaData = source.readBundle();
}

/**
* Get the ApplicationInfo for the application to which this item belongs,
* if available, otherwise returns null.
*
* @return Returns the ApplicationInfo of this item, or null if not known.
*
* @hide
*/
protected ApplicationInfo getApplicationInfo() {
return null;
}

public static class DisplayNameComparator
implements Comparator<PackageItemInfo> {
public DisplayNameComparator(PackageManager pm) {
mPM = pm;
}

public final int compare(PackageItemInfo aa, PackageItemInfo ab) {
CharSequence sa = aa.loadLabel(mPM);
if (sa == null) sa = aa.name;
CharSequence sb = ab.loadLabel(mPM);
if (sb == null) sb = ab.name;
return sCollator.compare(sa.toString(), sb.toString());
}

private final Collator sCollator = Collator.getInstance();
private PackageManager mPM;
}
}
Loading

0 comments on commit bfdb8a7

Please sign in to comment.