Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6e4cbfd2 authored by Jae Seo's avatar Jae Seo
Browse files

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
parent 392f2d3b
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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
+6 −6
Original line number Diff line number Diff line
@@ -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;
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -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
+8 −11
Original line number Diff line number Diff line
@@ -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();
+1 −1
Original line number Diff line number Diff line
@@ -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
     */
Loading