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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -16,10 +16,10 @@
package android.annotation; package android.annotation;
import java.lang.annotation.Target;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/** /**
* Indicates a constant field value should be exported to be used in the SDK tools. * Indicates a constant field value should be exported to be used in the SDK tools.
@@ -29,7 +29,11 @@ import java.lang.annotation.RetentionPolicy;
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
public @interface SdkConstant { public @interface SdkConstant {
public static enum SdkConstantType { public static enum SdkConstantType {
ACTIVITY_INTENT_ACTION, BROADCAST_INTENT_ACTION, SERVICE_ACTION, INTENT_CATEGORY, FEATURE; ACTIVITY_INTENT_ACTION,
BROADCAST_INTENT_ACTION,
SERVICE_ACTION,
INTENT_CATEGORY,
FEATURE;
} }
SdkConstantType value(); SdkConstantType value();

View File

@@ -26,7 +26,9 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
/** Indicates that Lint should ignore the specified warnings for the annotated element. */ /**
* Indicates that Lint should ignore the specified warnings for the annotated element.
*/
@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE}) @Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE})
@Retention(RetentionPolicy.CLASS) @Retention(RetentionPolicy.CLASS)
public @interface SuppressLint { public @interface SuppressLint {

View File

@@ -23,8 +23,10 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
/** Indicates that Lint should treat this type as targeting a given API level, no matter what the /**
project target is. */ Indicates that Lint should treat this type as targeting a given API level, no matter what the
project target is.
*/
@Target({TYPE, METHOD, CONSTRUCTOR}) @Target({TYPE, METHOD, CONSTRUCTOR})
@Retention(RetentionPolicy.CLASS) @Retention(RetentionPolicy.CLASS)
public @interface TargetApi { public @interface TargetApi {

View File

@@ -16,10 +16,10 @@
package android.annotation; package android.annotation;
import java.lang.annotation.Target;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/** /**
* Indicates a class is a widget usable by application developers to create UI. * Indicates a class is a widget usable by application developers to create UI.

View File

@@ -1,31 +1,27 @@
package android.app; package android.app;
import android.content.Context;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.XmlResourceParser; import android.content.res.XmlResourceParser;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater;
import android.widget.TextView;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.LayoutInflater;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.WindowManagerImpl; import android.view.WindowManagerImpl;
import android.widget.TextView;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserFactory;
import com.reandroid.arsc.chunk.xml.AndroidManifestBlock; import com.reandroid.arsc.chunk.xml.AndroidManifestBlock;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.StringReader; import java.io.StringReader;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserFactory;
public class Activity extends Context { public class Activity extends Context {
LayoutInflater layout_inflater; LayoutInflater layout_inflater;

View File

@@ -34,15 +34,13 @@ import android.view.SurfaceView;
import android.view.View; import android.view.View;
import android.view.ViewTreeObserver.OnGlobalLayoutListener; import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.view.WindowManager; import android.view.WindowManager;
//import android.view.inputmethod.InputMethodManager;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import com.reandroid.arsc.chunk.xml.AndroidManifestBlock; import com.reandroid.arsc.chunk.xml.AndroidManifestBlock;
import com.reandroid.arsc.chunk.xml.ResXmlAttribute; import com.reandroid.arsc.chunk.xml.ResXmlAttribute;
import com.reandroid.arsc.chunk.xml.ResXmlElement; import com.reandroid.arsc.chunk.xml.ResXmlElement;
// import android.view.inputmethod.InputMethodManager;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
/** /**
* Convenience for implementing an activity that will be implemented * Convenience for implementing an activity that will be implemented
@@ -204,7 +202,8 @@ public class NativeActivity extends Activity implements SurfaceHolder.Callback,
} }
byte[] nativeSavedState = savedInstanceState != null byte[] nativeSavedState = savedInstanceState != null
? savedInstanceState.getByteArray(KEY_NATIVE_SAVED_STATE) : null; ? savedInstanceState.getByteArray(KEY_NATIVE_SAVED_STATE)
: null;
mNativeHandle = loadNativeCode(path, funcname, Looper.myQueue(), mNativeHandle = loadNativeCode(path, funcname, Looper.myQueue(),
getAbsolutePath(getFilesDir()), getAbsolutePath(getObbDir()), getAbsolutePath(getFilesDir()), getAbsolutePath(getObbDir()),

View File

@@ -16,6 +16,5 @@ public class PendingIntent {
public void send(Context context, int code, Intent intent) {} public void send(Context context, int code, Intent intent) {}
public class CanceledException extends Exception { public class CanceledException extends Exception {
} }
} }

View File

@@ -17,19 +17,15 @@
package android.app; package android.app;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.system.ErrnoException;
// import android.os.FileUtils; // import android.os.FileUtils;
// import android.os.Looper; // import android.os.Looper;
import android.system.Os; import android.system.Os;
import android.system.StructStat; import android.system.StructStat;
import android.util.Log; import android.util.Log;
// import com.google.android.collect.Maps; // import com.google.android.collect.Maps;
import com.android.internal.util.XmlUtils; import com.android.internal.util.XmlUtils;
import dalvik.system.BlockGuard; import dalvik.system.BlockGuard;
import org.xmlpull.v1.XmlPullParserException;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
@@ -45,9 +41,8 @@ import java.util.Set;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import android.system.ErrnoException;
import libcore.io.IoUtils; import libcore.io.IoUtils;
import org.xmlpull.v1.XmlPullParserException;
public final class SharedPreferencesImpl implements SharedPreferences { public final class SharedPreferencesImpl implements SharedPreferences {
private static final String TAG = "SharedPreferencesImpl"; private static final String TAG = "SharedPreferencesImpl";
@@ -159,7 +154,8 @@ public final class SharedPreferencesImpl implements SharedPreferences {
synchronized (this) { synchronized (this) {
if (mDiskWritesInFlight > 0) { if (mDiskWritesInFlight > 0) {
// If we know we caused it, it's not unexpected. // If we know we caused it, it's not unexpected.
if (DEBUG) Log.d(TAG, "disk write in flight, not unexpected."); if (DEBUG)
Log.d(TAG, "disk write in flight, not unexpected.");
return false; return false;
} }
} }
@@ -483,7 +479,8 @@ public final class SharedPreferencesImpl implements SharedPreferences {
} }
}); });
} }
*/} */
}
} }
/** /**
@@ -574,8 +571,7 @@ public final class SharedPreferencesImpl implements SharedPreferences {
} }
if (!mBackupFile.exists()) { if (!mBackupFile.exists()) {
if (!mFile.renameTo(mBackupFile)) { if (!mFile.renameTo(mBackupFile)) {
Log.e(TAG, "Couldn't rename file " + mFile Log.e(TAG, "Couldn't rename file " + mFile + " to backup file " + mBackupFile);
+ " to backup file " + mBackupFile);
mcr.setDiskWriteResult(false); mcr.setDiskWriteResult(false);
return; return;
} }

View File

@@ -1,5 +1,4 @@
package android.content; package android.content;
public class ActivityNotFoundException extends Exception { public class ActivityNotFoundException extends Exception {
} }

View File

@@ -1,5 +1,4 @@
package android.content; package android.content;
public class BroadcastReceiver { public class BroadcastReceiver {
} }

View File

@@ -15,10 +15,10 @@
*/ */
package android.content; package android.content;
import android.content.Context; import android.content.Context;
import android.os.Message;
import android.os.RemoteException;
import android.os.Handler; import android.os.Handler;
import android.os.IBinder; import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
import android.util.Log; import android.util.Log;
import java.util.ArrayList; import java.util.ArrayList;
@@ -65,7 +65,9 @@ public class ClipboardManager extends android.text.ClipboardManager {
*/ */
void onPrimaryClipChanged(); void onPrimaryClipChanged();
} }
/** {@hide} */ /**
* {@hide}
*/
public ClipboardManager(Context context, Handler handler) { public ClipboardManager(Context context, Handler handler) {
} }
public ClipboardManager() { public ClipboardManager() {

View File

@@ -42,8 +42,10 @@ public final class ComponentName implements Cloneable, Comparable<ComponentName>
* implements the component. Can not be null. * implements the component. Can not be null.
*/ */
public ComponentName(String pkg, String cls) { public ComponentName(String pkg, String cls) {
if (pkg == null) throw new NullPointerException("package name is null"); if (pkg == null)
if (cls == null) throw new NullPointerException("class name is null"); throw new NullPointerException("package name is null");
if (cls == null)
throw new NullPointerException("class name is null");
mPackage = pkg; mPackage = pkg;
mClass = cls; mClass = cls;
} }
@@ -57,7 +59,8 @@ public final class ComponentName implements Cloneable, Comparable<ComponentName>
* implements the component. * implements the component.
*/ */
public ComponentName(Context pkg, String cls) { public ComponentName(Context pkg, String cls) {
if (cls == null) throw new NullPointerException("class name is null"); if (cls == null)
throw new NullPointerException("class name is null");
mPackage = pkg.getPackageName(); mPackage = pkg.getPackageName();
mClass = cls; mClass = cls;
} }
@@ -167,18 +170,24 @@ public final class ComponentName implements Cloneable, Comparable<ComponentName>
return sb.toString(); return sb.toString();
} }
/** @hide */ /**
* @hide
*/
public void appendShortString(StringBuilder sb) { public void appendShortString(StringBuilder sb) {
appendShortString(sb, mPackage, mClass); appendShortString(sb, mPackage, mClass);
} }
/** @hide */ /**
* @hide
*/
public static void appendShortString(StringBuilder sb, String packageName, String className) { public static void appendShortString(StringBuilder sb, String packageName, String className) {
sb.append(packageName).append('/'); sb.append(packageName).append('/');
appendShortClassName(sb, packageName, className); appendShortClassName(sb, packageName, className);
} }
/** @hide */ /**
* @hide
*/
public static void printShortString(PrintWriter pw, String packageName, String className) { public static void printShortString(PrintWriter pw, String packageName, String className) {
pw.print(packageName); pw.print(packageName);
pw.print('/'); pw.print('/');
@@ -234,8 +243,7 @@ public final class ComponentName implements Cloneable, Comparable<ComponentName>
ComponentName other = (ComponentName)obj; ComponentName other = (ComponentName)obj;
// Note: no null checks, because mPackage and mClass can // Note: no null checks, because mPackage and mClass can
// never be null. // never be null.
return mPackage.equals(other.mPackage) return mPackage.equals(other.mPackage) && mClass.equals(other.mClass);
&& mClass.equals(other.mClass);
} }
} catch (ClassCastException e) { } catch (ClassCastException e) {
} }

View File

@@ -1,7 +1,7 @@
package android.content; package android.content;
import android.net.Uri;
import android.database.ContentObserver; import android.database.ContentObserver;
import android.net.Uri;
public class ContentResolver { public class ContentResolver {
public final void registerContentObserver(Uri uri, boolean notifyForDescendants, ContentObserver observer) { public final void registerContentObserver(Uri uri, boolean notifyForDescendants, ContentObserver observer) {

View File

@@ -17,7 +17,6 @@
package android.content; package android.content;
import android.util.Log; import android.util.Log;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@@ -30,7 +29,9 @@ import java.util.Set;
public final class ContentValues { public final class ContentValues {
public static final String TAG = "ContentValues"; public static final String TAG = "ContentValues";
/** Holds the actual values */ /**
* Holds the actual values
*/
private HashMap<String, Object> mValues; private HashMap<String, Object> mValues;
/** /**
@@ -483,7 +484,8 @@ public final class ContentValues {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (String name : mValues.keySet()) { for (String name : mValues.keySet()) {
String value = getAsString(name); String value = getAsString(name);
if (sb.length() > 0) sb.append(" "); if (sb.length() > 0)
sb.append(" ");
sb.append(name + "=" + value); sb.append(name + "=" + value);
} }
return sb.toString(); return sb.toString();

View File

@@ -1,40 +1,36 @@
package android.content; package android.content;
import android.util.Log; import android.app.ActivityManager;
import android.app.AlarmManager;
import android.content.pm.PackageManager; import android.app.Application;
import android.app.KeyguardManager;
import android.app.NotificationManager;
import android.app.SharedPreferencesImpl;
import android.content.BroadcastReceiver;
import android.content.ClipboardManager;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo; import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.AssetManager; import android.content.res.AssetManager;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.Resources; import android.content.res.Resources;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.content.Intent; import android.hardware.SensorManager;
import android.content.BroadcastReceiver; import android.hardware.display.DisplayManager;
import android.hardware.usb.UsbManager;
import android.util.AttributeSet; import android.media.AudioManager;
import android.util.DisplayMetrics; import android.media.MediaRouter;
import android.content.SharedPreferences; import android.net.ConnectivityManager;
import android.app.SharedPreferencesImpl;
import android.os.Looper; import android.os.Looper;
import android.os.PowerManager; import android.os.PowerManager;
import android.app.Application; import android.os.Vibrator;
import android.telephony.TelephonyManager;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.WindowManagerImpl; import android.view.WindowManagerImpl;
import android.content.ClipboardManager;
import android.hardware.SensorManager;
import android.net.ConnectivityManager;
import android.app.KeyguardManager;
import android.telephony.TelephonyManager;
import android.media.AudioManager;
import android.app.ActivityManager;
import android.hardware.usb.UsbManager;
import android.os.Vibrator;
import android.hardware.display.DisplayManager;
import android.media.MediaRouter;
import android.app.NotificationManager;
import android.app.AlarmManager;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;

View File

@@ -3,7 +3,6 @@ package android.content;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.os.Parcelable; import android.os.Parcelable;
import java.io.Serializable; import java.io.Serializable;
public class Intent { public class Intent {

View File

@@ -1,5 +1,4 @@
package android.content; package android.content;
public interface ServiceConnection { public interface ServiceConnection {
} }

View File

@@ -429,7 +429,8 @@ public class ActivityInfo extends ComponentInfo {
*/ */
public static final int CONFIG_FONT_SCALE = 0x40000000; public static final int CONFIG_FONT_SCALE = 0x40000000;
/** @hide /**
* @hide
* Unfortunately the constants for config changes in native code are * Unfortunately the constants for config changes in native code are
* different from ActivityInfo. :( Here are the values we should use for the * different from ActivityInfo. :( Here are the values we should use for the
* native side given the bit we have assigned in ActivityInfo. * native side given the bit we have assigned in ActivityInfo.
@@ -450,7 +451,8 @@ public class ActivityInfo extends ComponentInfo {
Configuration.NATIVE_CONFIG_DENSITY, // DENSITY Configuration.NATIVE_CONFIG_DENSITY, // DENSITY
Configuration.NATIVE_CONFIG_LAYOUTDIR, // LAYOUT DIRECTION Configuration.NATIVE_CONFIG_LAYOUTDIR, // LAYOUT DIRECTION
}*/; }*/;
/** @hide /**
* @hide
* Convert Java change bits to native. * Convert Java change bits to native.
*/ */
public static int activityInfoConfigToNative(int input) { public static int activityInfoConfigToNative(int input) {
@@ -473,8 +475,7 @@ public class ActivityInfo extends ComponentInfo {
*/ */
public int getRealConfigChanged() { public int getRealConfigChanged() {
return applicationInfo.targetSdkVersion < android.os.Build.VERSION_CODES.HONEYCOMB_MR2 return applicationInfo.targetSdkVersion < android.os.Build.VERSION_CODES.HONEYCOMB_MR2
? (configChanges | ActivityInfo.CONFIG_SCREEN_SIZE ? (configChanges | ActivityInfo.CONFIG_SCREEN_SIZE | ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE)
| ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE)
: configChanges; : configChanges;
} }
@@ -556,18 +557,12 @@ public class ActivityInfo extends ComponentInfo {
if (permission != null) { if (permission != null) {
pw.println(prefix + "permission=" + permission); pw.println(prefix + "permission=" + permission);
} }
pw.println(prefix + "taskAffinity=" + taskAffinity pw.println(prefix + "taskAffinity=" + taskAffinity + " targetActivity=" + targetActivity);
+ " targetActivity=" + targetActivity);
if (launchMode != 0 || flags != 0 || theme != 0) { if (launchMode != 0 || flags != 0 || theme != 0) {
pw.println(prefix + "launchMode=" + launchMode pw.println(prefix + "launchMode=" + launchMode + " flags=0x" + Integer.toHexString(flags) + " theme=0x" + Integer.toHexString(theme));
+ " flags=0x" + Integer.toHexString(flags)
+ " theme=0x" + Integer.toHexString(theme));
} }
if (screenOrientation != SCREEN_ORIENTATION_UNSPECIFIED if (screenOrientation != SCREEN_ORIENTATION_UNSPECIFIED || configChanges != 0 || softInputMode != 0) {
|| configChanges != 0 || softInputMode != 0) { pw.println(prefix + "screenOrientation=" + screenOrientation + " configChanges=0x" + Integer.toHexString(configChanges) + " softInputMode=0x" + Integer.toHexString(softInputMode));
pw.println(prefix + "screenOrientation=" + screenOrientation
+ " configChanges=0x" + Integer.toHexString(configChanges)
+ " softInputMode=0x" + Integer.toHexString(softInputMode));
} }
if (uiOptions != 0) { if (uiOptions != 0) {
pw.println(prefix + " uiOptions=0x" + Integer.toHexString(uiOptions)); pw.println(prefix + " uiOptions=0x" + Integer.toHexString(uiOptions));
@@ -576,9 +571,7 @@ public class ActivityInfo extends ComponentInfo {
} }
public String toString() { public String toString() {
return "ActivityInfo{" return "ActivityInfo{" + Integer.toHexString(System.identityHashCode(this)) + " " + name + "}";
+ Integer.toHexString(System.identityHashCode(this))
+ " " + name + "}";
} }
public int describeContents() { public int describeContents() {

Some files were not shown because too many files have changed in this diff Show More