src/api-impl: fix up code style, mainly for code imported from AOSP

used the following (plus manual edits):
`clang-format --style="{BasedOnStyle: LLVM, IndentWidth: 8, UseTab: Always, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: true, ColumnLimit: 0}`
This commit is contained in:
Mis012
2023-06-22 11:45:46 +02:00
parent 824b821f5a
commit 0a9591c474
208 changed files with 154568 additions and 150150 deletions

View File

@@ -16,7 +16,7 @@
package android.content.pm;
//import android.graphics.drawable.Drawable;
// import android.graphics.drawable.Drawable;
import android.util.Printer;
/**
@@ -28,143 +28,147 @@ import android.util.Printer;
* in the implementation of Parcelable in subclasses.
*/
public class ComponentInfo extends PackageItemInfo {
/**
* Global information about the application/package this component is a
* part of.
*/
public ApplicationInfo applicationInfo;
/**
* The name of the process this component should run in.
* From the "android:process" attribute or, if not set, the same
* as <var>applicationInfo.processName</var>.
*/
public String processName;
/**
* Global information about the application/package this component is a
* part of.
*/
public ApplicationInfo applicationInfo;
/**
* A string resource identifier (in the package's resources) containing
* a user-readable description of the component. From the "description"
* attribute or, if not set, 0.
*/
public int descriptionRes;
/**
* Indicates whether or not this component may be instantiated. Note that this value can be
* overriden by the one in its parent {@link ApplicationInfo}.
*/
public boolean enabled = true;
/**
* The name of the process this component should run in.
* From the "android:process" attribute or, if not set, the same
* as <var>applicationInfo.processName</var>.
*/
public String processName;
/**
* Set to true if this component is available for use by other applications.
* Comes from {@link android.R.attr#exported android:exported} of the
* &lt;activity&gt;, &lt;receiver&gt;, &lt;service&gt;, or
* &lt;provider&gt; tag.
*/
public boolean exported = false;
public ComponentInfo() {
}
/**
* A string resource identifier (in the package's resources) containing
* a user-readable description of the component. From the "description"
* attribute or, if not set, 0.
*/
public int descriptionRes;
public ComponentInfo(ComponentInfo orig) {
super(orig);
applicationInfo = orig.applicationInfo;
processName = orig.processName;
descriptionRes = orig.descriptionRes;
enabled = orig.enabled;
exported = orig.exported;
}
/**
* Indicates whether or not this component may be instantiated. Note that this value can be
* overriden by the one in its parent {@link ApplicationInfo}.
*/
public boolean enabled = true;
@Override public CharSequence loadLabel(PackageManager pm) {/*
if (nonLocalizedLabel != null) {
return nonLocalizedLabel;
}
ApplicationInfo ai = applicationInfo;
CharSequence label;
if (labelRes != 0) {
label = pm.getText(packageName, labelRes, ai);
if (label != null) {
return label;
}
}
if (ai.nonLocalizedLabel != null) {
return ai.nonLocalizedLabel;
}
if (ai.labelRes != 0) {
label = pm.getText(packageName, ai.labelRes, ai);
if (label != null) {
return label;
}
}
return name;
*/return null;}
/**
* Set to true if this component is available for use by other applications.
* Comes from {@link android.R.attr#exported android:exported} of the
* &lt;activity&gt;, &lt;receiver&gt;, &lt;service&gt;, or
* &lt;provider&gt; tag.
*/
public boolean exported = false;
/**
* Return whether this component and its enclosing application are enabled.
*/
public boolean isEnabled() {
return enabled /*&& applicationInfo.enabled*/;
}
/**
* Return the icon resource identifier to use for this component. If
* the component defines an icon, that is used; else, the application
* icon is used.
*
* @return The icon associated with this component.
*/
public final int getIconResource() {
return icon;// != 0 ? icon : applicationInfo.icon;
}
public ComponentInfo() {
}
/**
* Return the logo resource identifier to use for this component. If
* the component defines a logo, that is used; else, the application
* logo is used.
*
* @return The logo associated with this component.
*/
public final int getLogoResource() {
return logo;// != 0 ? logo : applicationInfo.logo;
}
protected void dumpFront(Printer pw, String prefix) {
super.dumpFront(pw, prefix);
pw.println(prefix + "enabled=" + enabled + " exported=" + exported
+ " processName=" + processName);
if (descriptionRes != 0) {
pw.println(prefix + "description=" + descriptionRes);
}
}
protected void dumpBack(Printer pw, String prefix) {
if (applicationInfo != null) {
pw.println(prefix + "ApplicationInfo:");
//applicationInfo.dump(pw, prefix + " ");
} else {
pw.println(prefix + "ApplicationInfo: null");
}
super.dumpBack(pw, prefix);
}
/**
* @hide
*/
@Override protected Drawable loadDefaultIcon(PackageManager pm) {
return null;//applicationInfo.loadIcon(pm);
}
/**
* @hide
*/
@Override
protected Drawable loadDefaultLogo(PackageManager pm) {
return null;//applicationInfo.loadLogo(pm);
}
/**
* @hide
*/
@Override protected ApplicationInfo getApplicationInfo() {
return applicationInfo;
}
public ComponentInfo(ComponentInfo orig) {
super(orig);
applicationInfo = orig.applicationInfo;
processName = orig.processName;
descriptionRes = orig.descriptionRes;
enabled = orig.enabled;
exported = orig.exported;
}
@Override
public CharSequence loadLabel(PackageManager pm) { /*
if (nonLocalizedLabel != null) {
return nonLocalizedLabel;
}
ApplicationInfo ai = applicationInfo;
CharSequence label;
if (labelRes != 0) {
label = pm.getText(packageName, labelRes, ai);
if (label != null) {
return label;
}
}
if (ai.nonLocalizedLabel != null) {
return ai.nonLocalizedLabel;
}
if (ai.labelRes != 0) {
label = pm.getText(packageName, ai.labelRes, ai);
if (label != null) {
return label;
}
}
return name;
*/
return null;
}
/**
* Return whether this component and its enclosing application are enabled.
*/
public boolean isEnabled() {
return enabled /*&& applicationInfo.enabled*/;
}
/**
* Return the icon resource identifier to use for this component. If
* the component defines an icon, that is used; else, the application
* icon is used.
*
* @return The icon associated with this component.
*/
public final int getIconResource() {
return icon; // != 0 ? icon : applicationInfo.icon;
}
/**
* Return the logo resource identifier to use for this component. If
* the component defines a logo, that is used; else, the application
* logo is used.
*
* @return The logo associated with this component.
*/
public final int getLogoResource() {
return logo; // != 0 ? logo : applicationInfo.logo;
}
protected void dumpFront(Printer pw, String prefix) {
super.dumpFront(pw, prefix);
pw.println(prefix + "enabled=" + enabled + " exported=" + exported + " processName=" + processName);
if (descriptionRes != 0) {
pw.println(prefix + "description=" + descriptionRes);
}
}
protected void dumpBack(Printer pw, String prefix) {
if (applicationInfo != null) {
pw.println(prefix + "ApplicationInfo:");
// applicationInfo.dump(pw, prefix + " ");
} else {
pw.println(prefix + "ApplicationInfo: null");
}
super.dumpBack(pw, prefix);
}
/**
* @hide
*/
@Override
protected Drawable loadDefaultIcon(PackageManager pm) {
return null; // applicationInfo.loadIcon(pm);
}
/**
* @hide
*/
@Override
protected Drawable loadDefaultLogo(PackageManager pm) {
return null; // applicationInfo.loadLogo(pm);
}
/**
* @hide
*/
@Override
protected ApplicationInfo getApplicationInfo() {
return applicationInfo;
}
}