diff options
author | Ang Li <angli@google.com> | 2017-03-13 13:40:11 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-13 13:40:11 -0700 |
commit | 3797ad61618f23003445805a0545cf8d2bc08e94 (patch) | |
tree | 784740b8118d2cd351ce57d13a6247b67996497d | |
parent | faac43080b9f1c4d7d33943b4c38c9387012b7eb (diff) | |
download | mobly-snippet-lib-3797ad61618f23003445805a0545cf8d2bc08e94.tar.gz |
Fix lint for multiple files. (#53)
Purely cosmetic changes by AOSP linter.
6 files changed, 43 insertions, 31 deletions
diff --git a/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/event/EventSnippet.java b/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/event/EventSnippet.java index fb11720..ee1a21a 100644 --- a/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/event/EventSnippet.java +++ b/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/event/EventSnippet.java @@ -30,6 +30,7 @@ import org.json.JSONObject; public class EventSnippet implements Snippet { private static class EventSnippetException extends Exception { private static final long serialVersionUID = 1L; + public EventSnippetException(String msg) { super(msg); } diff --git a/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/manager/SnippetManager.java b/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/manager/SnippetManager.java index 4befdd5..ff0aec3 100644 --- a/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/manager/SnippetManager.java +++ b/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/manager/SnippetManager.java @@ -101,13 +101,14 @@ public class SnippetManager { Method method = entry.getKey().getMethod("shutdown"); if (method.isAnnotationPresent(RunOnUiThread.class)) { Log.d("Shutting down " + entry.getKey().getName() + " on the main thread"); - MainThread.run(new Callable<Void>() { - @Override - public Void call() throws Exception { - entry.getValue().shutdown(); - return null; - } - }); + MainThread.run( + new Callable<Void>() { + @Override + public Void call() throws Exception { + entry.getValue().shutdown(); + return null; + } + }); } else { Log.d("Shutting down " + entry.getKey().getName()); entry.getValue().shutdown(); @@ -125,12 +126,14 @@ public class SnippetManager { final Constructor<? extends Snippet> constructor = clazz.getConstructor(); if (constructor.isAnnotationPresent(RunOnUiThread.class)) { Log.d("Constructing " + clazz + " on the main thread"); - snippetImpl = MainThread.run(new Callable<Snippet>() { - @Override - public Snippet call() throws Exception { - return constructor.newInstance(); - } - }); + snippetImpl = + MainThread.run( + new Callable<Snippet>() { + @Override + public Snippet call() throws Exception { + return constructor.newInstance(); + } + }); } else { Log.d("Constructing " + clazz); snippetImpl = constructor.newInstance(); @@ -145,14 +148,19 @@ public class SnippetManager { private Object invoke(final Snippet snippetImpl, final Method method, final Object[] args) throws Exception { if (method.isAnnotationPresent(RunOnUiThread.class)) { - Log.d("Invoking RPC method " + method.getDeclaringClass() + "#" + method.getName() - + " on the main thread"); - return MainThread.run(new Callable<Object>() { - @Override - public Object call() throws Exception { - return method.invoke(snippetImpl, args); - } - }); + Log.d( + "Invoking RPC method " + + method.getDeclaringClass() + + "#" + + method.getName() + + " on the main thread"); + return MainThread.run( + new Callable<Object>() { + @Override + public Object call() throws Exception { + return method.invoke(snippetImpl, args); + } + }); } else { Log.d("Invoking RPC method " + method.getDeclaringClass() + "#" + method.getName()); return method.invoke(snippetImpl, args); diff --git a/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/rpc/JsonRpcServer.java b/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/rpc/JsonRpcServer.java index 0486482..e5a19db 100644 --- a/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/rpc/JsonRpcServer.java +++ b/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/rpc/JsonRpcServer.java @@ -76,7 +76,7 @@ public class JsonRpcServer extends SimpleServer { synchronized (writer) { // Shut down all RPC receivers. for (SnippetManager manager : - mSnippetManagerFactory.getSnippetManagers().values()) { + mSnippetManagerFactory.getSnippetManagers().values()) { manager.shutdown(); } diff --git a/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/rpc/RunOnUiThread.java b/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/rpc/RunOnUiThread.java index 3e2d31e..cde08f0 100644 --- a/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/rpc/RunOnUiThread.java +++ b/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/rpc/RunOnUiThread.java @@ -20,9 +20,11 @@ import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -/** This annotation will cause the RPC to execute on the main app thread. +/** + * This annotation will cause the RPC to execute on the main app thread. + * + * <p>This annotation can be applied to: * - * This annotation can be applied to: * <ul> * <li>The constructor of a class implementing the {@link Snippet} interface. * <li>A method annotated with the {@link Rpc} or {@link AsyncRpc} annotation. diff --git a/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/util/Log.java b/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/util/Log.java index 23c898c..c68631a 100644 --- a/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/util/Log.java +++ b/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/util/Log.java @@ -27,7 +27,7 @@ public final class Log { private Log() {} - public synchronized static void initLogTag(Context context) { + public static synchronized void initLogTag(Context context) { if (APK_LOG_TAG != null) { throw new IllegalStateException("Logger should not be re-initialized"); } @@ -38,14 +38,15 @@ public final class Log { appInfo = packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA); } catch (NameNotFoundException e) { throw new IllegalStateException( - "Failed to find ApplicationInfo with package name: " + packageName); + "Failed to find ApplicationInfo with package name: " + packageName); } Bundle bundle = appInfo.metaData; APK_LOG_TAG = bundle.getString("mobly-log-tag"); if (APK_LOG_TAG == null) { APK_LOG_TAG = packageName; - w("AndroidManifest.xml does not contain metadata field named \"mobly-log-tag\". " - + "Using package name for logging instead."); + w( + "AndroidManifest.xml does not contain metadata field named \"mobly-log-tag\". " + + "Using package name for logging instead."); } } diff --git a/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/util/MainThread.java b/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/util/MainThread.java index 44b4f2b..0e4ece5 100644 --- a/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/util/MainThread.java +++ b/third_party/sl4a/src/main/java/com/google/android/mobly/snippet/util/MainThread.java @@ -23,9 +23,9 @@ import java.util.concurrent.CountDownLatch; public class MainThread { /** - * Wraps a {@link Callable} in a {@link Runnable} that has a way to get the return value and - * exception after the fact. - */ + * Wraps a {@link Callable} in a {@link Runnable} that has a way to get the return value and + * exception after the fact. + */ private static class CallableWrapper<T> implements Runnable { private final Callable<T> mCallable; private final CountDownLatch mLatch = new CountDownLatch(1); |