You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
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:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -16,10 +16,10 @@
|
||||
|
||||
package android.annotation;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
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.
|
||||
@@ -29,7 +29,11 @@ import java.lang.annotation.RetentionPolicy;
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface SdkConstant {
|
||||
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();
|
||||
|
||||
@@ -26,7 +26,9 @@ import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
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})
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
public @interface SuppressLint {
|
||||
|
||||
@@ -23,8 +23,10 @@ import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
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})
|
||||
@Retention(RetentionPolicy.CLASS)
|
||||
public @interface TargetApi {
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
|
||||
package android.annotation;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Indicates a class is a widget usable by application developers to create UI.
|
||||
|
||||
@@ -1,31 +1,27 @@
|
||||
package android.app;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.XmlResourceParser;
|
||||
import android.os.Bundle;
|
||||
|
||||
import android.widget.TextView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.WindowManagerImpl;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserFactory;
|
||||
|
||||
import android.widget.TextView;
|
||||
import com.reandroid.arsc.chunk.xml.AndroidManifestBlock;
|
||||
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.StringReader;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserFactory;
|
||||
|
||||
public class Activity extends Context {
|
||||
LayoutInflater layout_inflater;
|
||||
|
||||
@@ -34,15 +34,13 @@ import android.view.SurfaceView;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
|
||||
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.ResXmlAttribute;
|
||||
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
|
||||
@@ -204,7 +202,8 @@ public class NativeActivity extends Activity implements SurfaceHolder.Callback,
|
||||
}
|
||||
|
||||
byte[] nativeSavedState = savedInstanceState != null
|
||||
? savedInstanceState.getByteArray(KEY_NATIVE_SAVED_STATE) : null;
|
||||
? savedInstanceState.getByteArray(KEY_NATIVE_SAVED_STATE)
|
||||
: null;
|
||||
|
||||
mNativeHandle = loadNativeCode(path, funcname, Looper.myQueue(),
|
||||
getAbsolutePath(getFilesDir()), getAbsolutePath(getObbDir()),
|
||||
|
||||
@@ -16,6 +16,5 @@ public class PendingIntent {
|
||||
public void send(Context context, int code, Intent intent) {}
|
||||
|
||||
public class CanceledException extends Exception {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,19 +17,15 @@
|
||||
package android.app;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.system.ErrnoException;
|
||||
// import android.os.FileUtils;
|
||||
// import android.os.Looper;
|
||||
import android.system.Os;
|
||||
import android.system.StructStat;
|
||||
import android.util.Log;
|
||||
|
||||
// import com.google.android.collect.Maps;
|
||||
import com.android.internal.util.XmlUtils;
|
||||
|
||||
import dalvik.system.BlockGuard;
|
||||
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -45,9 +41,8 @@ import java.util.Set;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import android.system.ErrnoException;
|
||||
import libcore.io.IoUtils;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
public final class SharedPreferencesImpl implements SharedPreferences {
|
||||
private static final String TAG = "SharedPreferencesImpl";
|
||||
@@ -159,7 +154,8 @@ public final class SharedPreferencesImpl implements SharedPreferences {
|
||||
synchronized (this) {
|
||||
if (mDiskWritesInFlight > 0) {
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
@@ -483,7 +479,8 @@ public final class SharedPreferencesImpl implements SharedPreferences {
|
||||
}
|
||||
});
|
||||
}
|
||||
*/}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -574,8 +571,7 @@ public final class SharedPreferencesImpl implements SharedPreferences {
|
||||
}
|
||||
if (!mBackupFile.exists()) {
|
||||
if (!mFile.renameTo(mBackupFile)) {
|
||||
Log.e(TAG, "Couldn't rename file " + mFile
|
||||
+ " to backup file " + mBackupFile);
|
||||
Log.e(TAG, "Couldn't rename file " + mFile + " to backup file " + mBackupFile);
|
||||
mcr.setDiskWriteResult(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
package android.content;
|
||||
|
||||
public class ActivityNotFoundException extends Exception {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
package android.content;
|
||||
|
||||
public class BroadcastReceiver {
|
||||
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
*/
|
||||
package android.content;
|
||||
import android.content.Context;
|
||||
import android.os.Message;
|
||||
import android.os.RemoteException;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.Message;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -65,7 +65,9 @@ public class ClipboardManager extends android.text.ClipboardManager {
|
||||
*/
|
||||
void onPrimaryClipChanged();
|
||||
}
|
||||
/** {@hide} */
|
||||
/**
|
||||
* {@hide}
|
||||
*/
|
||||
public ClipboardManager(Context context, Handler handler) {
|
||||
}
|
||||
public ClipboardManager() {
|
||||
|
||||
@@ -42,8 +42,10 @@ public final class ComponentName implements Cloneable, Comparable<ComponentName>
|
||||
* implements the component. Can not be null.
|
||||
*/
|
||||
public ComponentName(String pkg, String cls) {
|
||||
if (pkg == null) throw new NullPointerException("package name is null");
|
||||
if (cls == null) throw new NullPointerException("class name is null");
|
||||
if (pkg == null)
|
||||
throw new NullPointerException("package name is null");
|
||||
if (cls == null)
|
||||
throw new NullPointerException("class name is null");
|
||||
mPackage = pkg;
|
||||
mClass = cls;
|
||||
}
|
||||
@@ -57,7 +59,8 @@ public final class ComponentName implements Cloneable, Comparable<ComponentName>
|
||||
* implements the component.
|
||||
*/
|
||||
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();
|
||||
mClass = cls;
|
||||
}
|
||||
@@ -167,18 +170,24 @@ public final class ComponentName implements Cloneable, Comparable<ComponentName>
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public void appendShortString(StringBuilder sb) {
|
||||
appendShortString(sb, mPackage, mClass);
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public static void appendShortString(StringBuilder sb, String packageName, String className) {
|
||||
sb.append(packageName).append('/');
|
||||
appendShortClassName(sb, packageName, className);
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public static void printShortString(PrintWriter pw, String packageName, String className) {
|
||||
pw.print(packageName);
|
||||
pw.print('/');
|
||||
@@ -234,8 +243,7 @@ public final class ComponentName implements Cloneable, Comparable<ComponentName>
|
||||
ComponentName other = (ComponentName)obj;
|
||||
// Note: no null checks, because mPackage and mClass can
|
||||
// never be null.
|
||||
return mPackage.equals(other.mPackage)
|
||||
&& mClass.equals(other.mClass);
|
||||
return mPackage.equals(other.mPackage) && mClass.equals(other.mClass);
|
||||
}
|
||||
} catch (ClassCastException e) {
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package android.content;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.database.ContentObserver;
|
||||
import android.net.Uri;
|
||||
|
||||
public class ContentResolver {
|
||||
public final void registerContentObserver(Uri uri, boolean notifyForDescendants, ContentObserver observer) {
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package android.content;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -30,7 +29,9 @@ import java.util.Set;
|
||||
public final class ContentValues {
|
||||
public static final String TAG = "ContentValues";
|
||||
|
||||
/** Holds the actual values */
|
||||
/**
|
||||
* Holds the actual values
|
||||
*/
|
||||
private HashMap<String, Object> mValues;
|
||||
|
||||
/**
|
||||
@@ -483,7 +484,8 @@ public final class ContentValues {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String name : mValues.keySet()) {
|
||||
String value = getAsString(name);
|
||||
if (sb.length() > 0) sb.append(" ");
|
||||
if (sb.length() > 0)
|
||||
sb.append(" ");
|
||||
sb.append(name + "=" + value);
|
||||
}
|
||||
return sb.toString();
|
||||
|
||||
@@ -1,40 +1,36 @@
|
||||
package android.content;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import android.content.pm.PackageManager;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.AlarmManager;
|
||||
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.PackageManager;
|
||||
import android.content.res.AssetManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.content.Intent;
|
||||
import android.content.BroadcastReceiver;
|
||||
|
||||
import android.util.AttributeSet;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.content.SharedPreferences;
|
||||
import android.app.SharedPreferencesImpl;
|
||||
import android.hardware.SensorManager;
|
||||
import android.hardware.display.DisplayManager;
|
||||
import android.hardware.usb.UsbManager;
|
||||
import android.media.AudioManager;
|
||||
import android.media.MediaRouter;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.os.Looper;
|
||||
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.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.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
|
||||
@@ -3,7 +3,6 @@ package android.content;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Intent {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
package android.content;
|
||||
|
||||
public interface ServiceConnection {
|
||||
|
||||
}
|
||||
|
||||
@@ -429,7 +429,8 @@ public class ActivityInfo extends ComponentInfo {
|
||||
*/
|
||||
public static final int CONFIG_FONT_SCALE = 0x40000000;
|
||||
|
||||
/** @hide
|
||||
/**
|
||||
* @hide
|
||||
* Unfortunately the constants for config changes in native code are
|
||||
* different from ActivityInfo. :( Here are the values we should use for the
|
||||
* 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_LAYOUTDIR, // LAYOUT DIRECTION
|
||||
}*/;
|
||||
/** @hide
|
||||
/**
|
||||
* @hide
|
||||
* Convert Java change bits to native.
|
||||
*/
|
||||
public static int activityInfoConfigToNative(int input) {
|
||||
@@ -473,8 +475,7 @@ public class ActivityInfo extends ComponentInfo {
|
||||
*/
|
||||
public int getRealConfigChanged() {
|
||||
return applicationInfo.targetSdkVersion < android.os.Build.VERSION_CODES.HONEYCOMB_MR2
|
||||
? (configChanges | ActivityInfo.CONFIG_SCREEN_SIZE
|
||||
| ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE)
|
||||
? (configChanges | ActivityInfo.CONFIG_SCREEN_SIZE | ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE)
|
||||
: configChanges;
|
||||
}
|
||||
|
||||
@@ -556,18 +557,12 @@ public class ActivityInfo extends ComponentInfo {
|
||||
if (permission != null) {
|
||||
pw.println(prefix + "permission=" + permission);
|
||||
}
|
||||
pw.println(prefix + "taskAffinity=" + taskAffinity
|
||||
+ " targetActivity=" + targetActivity);
|
||||
pw.println(prefix + "taskAffinity=" + taskAffinity + " targetActivity=" + targetActivity);
|
||||
if (launchMode != 0 || flags != 0 || theme != 0) {
|
||||
pw.println(prefix + "launchMode=" + launchMode
|
||||
+ " flags=0x" + Integer.toHexString(flags)
|
||||
+ " theme=0x" + Integer.toHexString(theme));
|
||||
pw.println(prefix + "launchMode=" + launchMode + " flags=0x" + Integer.toHexString(flags) + " theme=0x" + Integer.toHexString(theme));
|
||||
}
|
||||
if (screenOrientation != SCREEN_ORIENTATION_UNSPECIFIED
|
||||
|| configChanges != 0 || softInputMode != 0) {
|
||||
pw.println(prefix + "screenOrientation=" + screenOrientation
|
||||
+ " configChanges=0x" + Integer.toHexString(configChanges)
|
||||
+ " softInputMode=0x" + Integer.toHexString(softInputMode));
|
||||
if (screenOrientation != SCREEN_ORIENTATION_UNSPECIFIED || configChanges != 0 || softInputMode != 0) {
|
||||
pw.println(prefix + "screenOrientation=" + screenOrientation + " configChanges=0x" + Integer.toHexString(configChanges) + " softInputMode=0x" + Integer.toHexString(softInputMode));
|
||||
}
|
||||
if (uiOptions != 0) {
|
||||
pw.println(prefix + " uiOptions=0x" + Integer.toHexString(uiOptions));
|
||||
@@ -576,9 +571,7 @@ public class ActivityInfo extends ComponentInfo {
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "ActivityInfo{"
|
||||
+ Integer.toHexString(System.identityHashCode(this))
|
||||
+ " " + name + "}";
|
||||
return "ActivityInfo{" + Integer.toHexString(System.identityHashCode(this)) + " " + name + "}";
|
||||
}
|
||||
|
||||
public int describeContents() {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user