diff options
author | Jae Seo <jaeseo@google.com> | 2015-06-21 16:40:34 -0700 |
---|---|---|
committer | Jae Seo <jaeseo@google.com> | 2015-06-21 17:09:04 -0700 |
commit | 6e4cbfd2e5ffb739269e5e4affc2b6894bc4090e (patch) | |
tree | 6cab2760951b3774c3ead38f91a421095190bebd /media/java/android | |
parent | 392f2d3b5d8407f7920e437a2d0db900251b4f81 (diff) | |
download | frameworks_base-6e4cbfd2e5ffb739269e5e4affc2b6894bc4090e.zip frameworks_base-6e4cbfd2e5ffb739269e5e4affc2b6894bc4090e.tar.gz frameworks_base-6e4cbfd2e5ffb739269e5e4affc2b6894bc4090e.tar.bz2 |
TIF: Minor code improvement
- Removed unnecessary 'final' keywords for private methods
- Removed unnecessary interface modifiers
- Added a missing ‘final’ keyword
- Simplified if statements
- Removed Javadoc links pointing to itself
- Removed redundant conditional expressions
- Removed unnecessary return statements
- Replaced explicit types with <>
- Removed an unnecessary unboxing
- Removed a redundant initializer
- Fixed typos
Change-Id: I1d137fda70192b33dd00e92ab01396519135ab39
Diffstat (limited to 'media/java/android')
-rw-r--r-- | media/java/android/media/tv/TvContract.java | 6 | ||||
-rw-r--r-- | media/java/android/media/tv/TvInputInfo.java | 12 | ||||
-rw-r--r-- | media/java/android/media/tv/TvInputManager.java | 2 | ||||
-rw-r--r-- | media/java/android/media/tv/TvInputService.java | 19 | ||||
-rw-r--r-- | media/java/android/media/tv/TvView.java | 2 |
5 files changed, 19 insertions, 22 deletions
diff --git a/media/java/android/media/tv/TvContract.java b/media/java/android/media/tv/TvContract.java index a06f848..da5f33e 100644 --- a/media/java/android/media/tv/TvContract.java +++ b/media/java/android/media/tv/TvContract.java @@ -282,12 +282,12 @@ public final class TvContract { return ContentUris.withAppendedId(WatchedPrograms.CONTENT_URI, watchedProgramId); } - private static final boolean isTvUri(Uri uri) { + private static boolean isTvUri(Uri uri) { return uri != null && ContentResolver.SCHEME_CONTENT.equals(uri.getScheme()) && AUTHORITY.equals(uri.getAuthority()); } - private static final boolean isTwoSegmentUriStartingWith(Uri uri, String pathSegment) { + private static boolean isTwoSegmentUriStartingWith(Uri uri, String pathSegment) { List<String> pathSegments = uri.getPathSegments(); return pathSegments.size() == 2 && pathSegment.equals(pathSegments.get(0)); } @@ -565,7 +565,7 @@ public final class TvContract { * defined there (e.g. ETSI EN 300 468/TR 101 211 and ARIB STD-B10). If channels cannot be * globally identified by 2-tuple {{@link #COLUMN_TRANSPORT_STREAM_ID}, * {@link #COLUMN_SERVICE_ID}}, one must carefully assign a value to this field to form a - * unique 3-tuple identification {{@link #COLUMN_ORIGINAL_NETWORK_ID}, + * unique 3-tuple identification {{@code COLUMN_ORIGINAL_NETWORK_ID}, * {@link #COLUMN_TRANSPORT_STREAM_ID}, {@link #COLUMN_SERVICE_ID}} for its channels. * * <p>This is a required field if the channel cannot be uniquely identified by a 2-tuple diff --git a/media/java/android/media/tv/TvInputInfo.java b/media/java/android/media/tv/TvInputInfo.java index 5d1aa14..ce72c2f 100644 --- a/media/java/android/media/tv/TvInputInfo.java +++ b/media/java/android/media/tv/TvInputInfo.java @@ -106,7 +106,7 @@ public final class TvInputInfo implements Parcelable { */ public static final String EXTRA_INPUT_ID = "android.media.tv.extra.INPUT_ID"; - private static SparseIntArray sHardwareTypeToTvInputType = new SparseIntArray(); + private static final SparseIntArray sHardwareTypeToTvInputType = new SparseIntArray(); private static final String XML_START_TAG_NAME = "tv-input"; private static final String DELIMITER_INFO_IN_ID = "/"; @@ -594,7 +594,7 @@ public final class TvInputInfo implements Parcelable { * @param name the component name for generating an input id. * @return the generated input id for the given {@code name}. */ - private static final String generateInputIdForComponentName(ComponentName name) { + private static String generateInputIdForComponentName(ComponentName name) { return name.flattenToShortString(); } @@ -605,7 +605,7 @@ public final class TvInputInfo implements Parcelable { * @param deviceInfo HdmiDeviceInfo describing this TV input. * @return the generated input id for the given {@code name} and {@code deviceInfo}. */ - private static final String generateInputIdForHdmiDevice( + private static String generateInputIdForHdmiDevice( ComponentName name, HdmiDeviceInfo deviceInfo) { // Example of the format : "/HDMI%04X%02X" String format = DELIMITER_INFO_IN_ID + PREFIX_HDMI_DEVICE @@ -622,7 +622,7 @@ public final class TvInputInfo implements Parcelable { * @param hardwareInfo TvInputHardwareInfo describing this TV input. * @return the generated input id for the given {@code name} and {@code hardwareInfo}. */ - private static final String generateInputIdForHardware( + private static String generateInputIdForHardware( ComponentName name, TvInputHardwareInfo hardwareInfo) { return name.flattenToShortString() + DELIMITER_INFO_IN_ID + PREFIX_HARDWARE_DEVICE + hardwareInfo.getDeviceId(); @@ -648,13 +648,13 @@ public final class TvInputInfo implements Parcelable { mSetupActivity = in.readString(); mSettingsActivity = in.readString(); mType = in.readInt(); - mIsHardwareInput = in.readByte() == 1 ? true : false; + mIsHardwareInput = in.readByte() == 1; mHdmiDeviceInfo = in.readParcelable(null); mIcon = in.readParcelable(null); mIconUri = in.readParcelable(null); mLabelRes = in.readInt(); mLabel = in.readString(); - mIsConnectedToHdmiSwitch = in.readByte() == 1 ? true : false; + mIsConnectedToHdmiSwitch = in.readByte() == 1; } /** diff --git a/media/java/android/media/tv/TvInputManager.java b/media/java/android/media/tv/TvInputManager.java index 38f2d04..eea607c 100644 --- a/media/java/android/media/tv/TvInputManager.java +++ b/media/java/android/media/tv/TvInputManager.java @@ -1929,7 +1929,7 @@ public final class TvInputManager { * @param handled {@code true} if the dispatched input event was handled properly. * {@code false} otherwise. */ - public void onFinishedInputEvent(Object token, boolean handled); + void onFinishedInputEvent(Object token, boolean handled); } // Must be called on the main looper diff --git a/media/java/android/media/tv/TvInputService.java b/media/java/android/media/tv/TvInputService.java index f52ccc9..35037bb 100644 --- a/media/java/android/media/tv/TvInputService.java +++ b/media/java/android/media/tv/TvInputService.java @@ -233,10 +233,7 @@ public abstract class TvInputService extends Service { mTvInputManager = (TvInputManager) getSystemService(Context.TV_INPUT_SERVICE); } TvInputInfo info = mTvInputManager.getTvInputInfo(inputId); - if (info != null && info.isPassthroughInput()) { - return true; - } - return false; + return info != null && info.isPassthroughInput(); } /** @@ -1383,7 +1380,7 @@ public abstract class TvInputService extends Service { } } - private final void executeOrPostRunnable(Runnable action) { + private void executeOrPostRunnable(Runnable action) { synchronized(mLock) { if (mSessionCallback == null) { // The session is not initialized yet. @@ -1651,13 +1648,13 @@ public abstract class TvInputService extends Service { if (sessionImpl instanceof HardwareSession) { HardwareSession proxySession = ((HardwareSession) sessionImpl); - String harewareInputId = proxySession.getHardwareInputId(); - if (TextUtils.isEmpty(harewareInputId) || - !isPassthroughInput(harewareInputId)) { - if (TextUtils.isEmpty(harewareInputId)) { + String hardwareInputId = proxySession.getHardwareInputId(); + if (TextUtils.isEmpty(hardwareInputId) || + !isPassthroughInput(hardwareInputId)) { + if (TextUtils.isEmpty(hardwareInputId)) { Log.w(TAG, "Hardware input id is not setup yet."); } else { - Log.w(TAG, "Invalid hardware input id : " + harewareInputId); + Log.w(TAG, "Invalid hardware input id : " + hardwareInputId); } sessionImpl.onRelease(); try { @@ -1672,7 +1669,7 @@ public abstract class TvInputService extends Service { proxySession.mServiceHandler = mServiceHandler; TvInputManager manager = (TvInputManager) getSystemService( Context.TV_INPUT_SERVICE); - manager.createSession(harewareInputId, + manager.createSession(hardwareInputId, proxySession.mHardwareSessionCallback, mServiceHandler); } else { SomeArgs someArgs = SomeArgs.obtain(); diff --git a/media/java/android/media/tv/TvView.java b/media/java/android/media/tv/TvView.java index d8d0bdc..64333ad 100644 --- a/media/java/android/media/tv/TvView.java +++ b/media/java/android/media/tv/TvView.java @@ -191,7 +191,7 @@ public class TvView extends ViewGroup { * the active source. * * <p>First tuned {@link TvView} becomes main automatically, and keeps to be main until either - * {@link #reset} is called for the main {@link TvView} or {@link #setMain} is called for other + * {@link #reset} is called for the main {@link TvView} or {@code setMain()} is called for other * {@link TvView}. * @hide */ |