Fix lint errors in Support Library demos

Does not fix Leanback demos.

Bug: 29630077
Test: ./gradlew support-...-demos:lint
Change-Id: Ib399d5b5c6108fc5977791623eefaf7e3c96cdcc
diff --git a/samples/Support4Demos/res/layout/accessibility_roledescription.xml b/samples/Support4Demos/res/layout/accessibility_roledescription.xml
index a617e09..842210d 100644
--- a/samples/Support4Demos/res/layout/accessibility_roledescription.xml
+++ b/samples/Support4Demos/res/layout/accessibility_roledescription.xml
@@ -35,7 +35,8 @@
                 android:padding="24dp"
                 android:background="#ffffff"
                 android:textColor="#000000"
-                android:text="@string/accessibility_roledescription_item"/>
+                android:text="@string/accessibility_roledescription_item"
+                android:layout_marginLeft="24dp"/>
 
         </LinearLayout>
 
@@ -56,7 +57,8 @@
                 android:layout_height="wrap_content"
                 android:layout_marginStart="0dp"
                 android:textSize="24sp"
-                android:text="@string/accessibility_roledescription_h1_item"/>
+                android:text="@string/accessibility_roledescription_h1_item"
+                android:layout_marginLeft="0dp"/>
 
             <TextView
                 android:id="@+id/text_heading_2"
@@ -64,7 +66,8 @@
                 android:layout_height="wrap_content"
                 android:layout_marginStart="24dp"
                 android:textSize="20sp"
-                android:text="@string/accessibility_roledescription_h2_item"/>
+                android:text="@string/accessibility_roledescription_h2_item"
+                android:layout_marginLeft="24dp"/>
 
             <TextView
                 android:id="@+id/text_heading_3"
@@ -72,7 +75,8 @@
                 android:layout_height="wrap_content"
                 android:layout_marginStart="48dp"
                 android:textSize="16sp"
-                android:text="@string/accessibility_roledescription_h3_item"/>
+                android:text="@string/accessibility_roledescription_h3_item"
+                android:layout_marginLeft="48dp"/>
 
         </LinearLayout>
 
diff --git a/samples/Support4Demos/res/layout/media_controller.xml b/samples/Support4Demos/res/layout/media_controller.xml
index b5e58b1..0c3e116 100644
--- a/samples/Support4Demos/res/layout/media_controller.xml
+++ b/samples/Support4Demos/res/layout/media_controller.xml
@@ -59,7 +59,9 @@
             android:layout_weight="1"
             android:layout_height="32dip"
             android:layout_alignParentStart="true"
-            android:layout_alignParentEnd="true" />
+            android:layout_alignParentEnd="true"
+            android:layout_alignParentRight="true"
+            android:layout_alignParentLeft="true" />
 
         <TextView android:id="@+id/time"
             android:textSize="14sp"
diff --git a/samples/Support4Demos/res/layout/media_list_item.xml b/samples/Support4Demos/res/layout/media_list_item.xml
index 72c0ccf..a1caed0 100644
--- a/samples/Support4Demos/res/layout/media_list_item.xml
+++ b/samples/Support4Demos/res/layout/media_list_item.xml
@@ -40,7 +40,8 @@
             android:layout_height="wrap_content"
             android:layout_marginStart="@dimen/margin_text_view"
             android:layout_marginTop="@dimen/margin_text_view"
-            android:textAppearance="?android:attr/textAppearanceMedium"/>
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:layout_marginLeft="@dimen/margin_text_view"/>
 
         <TextView
             android:id="@+id/description"
@@ -48,7 +49,8 @@
             android:layout_height="wrap_content"
             android:layout_marginStart="@dimen/margin_text_view"
             android:layout_marginTop="@dimen/margin_text_view"
-            android:textAppearance="?android:attr/textAppearanceSmall"/>
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:layout_marginLeft="@dimen/margin_text_view"/>
 
     </LinearLayout>
 
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/accessibility/AccessibilityManagerSupportActivity.java b/samples/Support4Demos/src/com/example/android/supportv4/accessibility/AccessibilityManagerSupportActivity.java
index d38e5b7..18c3c3e 100644
--- a/samples/Support4Demos/src/com/example/android/supportv4/accessibility/AccessibilityManagerSupportActivity.java
+++ b/samples/Support4Demos/src/com/example/android/supportv4/accessibility/AccessibilityManagerSupportActivity.java
@@ -88,7 +88,8 @@
             @Override
             public void onAccessibilityStateChanged(boolean enabled) {
                 Toast.makeText(AccessibilityManagerSupportActivity.this,
-                        getString(R.string.accessibility_manager_accessibility_state, enabled),
+                        getString(R.string.accessibility_manager_accessibility_state,
+                                Boolean.toString(enabled)),
                         Toast.LENGTH_SHORT).show();
             }
         });
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/app/LoaderCustomSupport.java b/samples/Support4Demos/src/com/example/android/supportv4/app/LoaderCustomSupport.java
index c2efecc..22267884 100644
--- a/samples/Support4Demos/src/com/example/android/supportv4/app/LoaderCustomSupport.java
+++ b/samples/Support4Demos/src/com/example/android/supportv4/app/LoaderCustomSupport.java
@@ -228,6 +228,7 @@
          */
         @Override public List<AppEntry> loadInBackground() {
             // Retrieve all known applications.
+            //noinspection WrongConstant
             List<ApplicationInfo> apps = mPm.getInstalledApplications(
                     PackageManager.MATCH_UNINSTALLED_PACKAGES
                             | PackageManager.MATCH_DISABLED_COMPONENTS);
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/media/MediaBrowserServiceSupport.java b/samples/Support4Demos/src/com/example/android/supportv4/media/MediaBrowserServiceSupport.java
index 035c62a..cb78006 100644
--- a/samples/Support4Demos/src/com/example/android/supportv4/media/MediaBrowserServiceSupport.java
+++ b/samples/Support4Demos/src/com/example/android/supportv4/media/MediaBrowserServiceSupport.java
@@ -16,6 +16,10 @@
 
 package com.example.android.supportv4.media;
 
+import static com.example.android.supportv4.media.utils.MediaIDHelper.MEDIA_ID_MUSICS_BY_GENRE;
+import static com.example.android.supportv4.media.utils.MediaIDHelper.MEDIA_ID_ROOT;
+import static com.example.android.supportv4.media.utils.MediaIDHelper.createBrowseCategoryMediaID;
+
 import android.app.PendingIntent;
 import android.content.Context;
 import android.content.Intent;
@@ -26,10 +30,10 @@
 import android.os.Message;
 import android.os.SystemClock;
 import android.support.v4.media.MediaBrowserCompat;
-import android.support.v4.media.MediaDescriptionCompat;
-import android.support.v4.media.MediaMetadataCompat;
 import android.support.v4.media.MediaBrowserCompat.MediaItem;
 import android.support.v4.media.MediaBrowserServiceCompat;
+import android.support.v4.media.MediaDescriptionCompat;
+import android.support.v4.media.MediaMetadataCompat;
 import android.support.v4.media.session.MediaButtonReceiver;
 import android.support.v4.media.session.MediaSessionCompat;
 import android.support.v4.media.session.PlaybackStateCompat;
@@ -47,10 +51,6 @@
 import java.util.Collections;
 import java.util.List;
 
-import static com.example.android.supportv4.media.utils.MediaIDHelper.MEDIA_ID_MUSICS_BY_GENRE;
-import static com.example.android.supportv4.media.utils.MediaIDHelper.MEDIA_ID_ROOT;
-import static com.example.android.supportv4.media.utils.MediaIDHelper.createBrowseCategoryMediaID;
-
 /**
  * This class provides a MediaBrowser through a service. It exposes the media library to a browsing
  * client, through the onGetRoot and onLoadChildren methods. It also creates a MediaSession and
@@ -119,8 +119,8 @@
     // A value of a CMD_NAME key in the extras of the incoming Intent that
     // indicates that the music playback should be paused (see {@link #onStartCommand})
     public static final String CMD_PAUSE = "CMD_PAUSE";
-
-    private static final String TAG = "SampleMediaBrowserService";
+    // Log tag must be <= 23 characters, so truncate class name.
+    private static final String TAG = "MediaBrowserService";
     // Action to thumbs up a media item
     private static final String CUSTOM_ACTION_THUMBS_UP =
             "com.example.android.supportv4.media.THUMBS_UP";
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/media/MediaController.java b/samples/Support4Demos/src/com/example/android/supportv4/media/MediaController.java
index b8d99d4..546fe8c 100644
--- a/samples/Support4Demos/src/com/example/android/supportv4/media/MediaController.java
+++ b/samples/Support4Demos/src/com/example/android/supportv4/media/MediaController.java
@@ -16,12 +16,10 @@
 
 package com.example.android.supportv4.media;
 
+import android.content.Context;
 import android.support.v4.media.TransportController;
 import android.support.v4.media.TransportMediator;
 import android.support.v4.media.TransportStateListener;
-import com.example.android.supportv4.R;
-
-import android.content.Context;
 import android.util.AttributeSet;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -29,10 +27,11 @@
 import android.view.accessibility.AccessibilityNodeInfo;
 import android.widget.FrameLayout;
 import android.widget.ImageButton;
-import android.widget.ProgressBar;
 import android.widget.SeekBar;
 import android.widget.TextView;
 
+import com.example.android.supportv4.R;
+
 import java.util.Formatter;
 import java.util.Locale;
 
@@ -45,7 +44,7 @@
 
     private TransportController mController;
     private Context mContext;
-    private ProgressBar mProgress;
+    private SeekBar mProgress;
     private TextView mEndTime, mCurrentTime;
     private boolean mDragging;
     private boolean mUseFastForward;
@@ -149,12 +148,9 @@
             mPrevButton.setVisibility(View.GONE);
         }
 
-        mProgress = (ProgressBar) findViewById(R.id.mediacontroller_progress);
+        mProgress = (SeekBar) findViewById(R.id.mediacontroller_progress);
         if (mProgress != null) {
-            if (mProgress instanceof SeekBar) {
-                SeekBar seeker = (SeekBar) mProgress;
-                seeker.setOnSeekBarChangeListener(mSeekListener);
-            }
+            mProgress.setOnSeekBarChangeListener(mSeekListener);
             mProgress.setMax(1000);
         }
 
diff --git a/samples/SupportDesignDemos/res/menu/navigation.xml b/samples/SupportDesignDemos/res/menu/navigation.xml
index de17967..4e61bf7 100644
--- a/samples/SupportDesignDemos/res/menu/navigation.xml
+++ b/samples/SupportDesignDemos/res/menu/navigation.xml
@@ -59,6 +59,7 @@
                     android:title="@string/navigation_sub_item_2"/>
             <item
                     android:id="@+id/navigation_sub_item_3"
+                    android:title="@string/navigation_sub_item_3"
                     app:actionLayout="@layout/action_layout_custom"/>
         </menu>
     </item>
diff --git a/samples/SupportDesignDemos/res/menu/sample_actions.xml b/samples/SupportDesignDemos/res/menu/sample_actions.xml
index b869ebc..aab91ed 100644
--- a/samples/SupportDesignDemos/res/menu/sample_actions.xml
+++ b/samples/SupportDesignDemos/res/menu/sample_actions.xml
@@ -18,11 +18,11 @@
     <item android:id="@+id/action_search"
           android:title="@string/menu_search"
           android:icon="@drawable/ic_search"
-          app:showAsAction="ifRoom"/>
+          android:showAsAction="ifRoom"/>
     <item android:id="@+id/action_toggle_expand"
           android:title="@string/menu_expand"
-          app:showAsAction="never" />
+          android:showAsAction="never" />
     <item android:id="@+id/action_toggle_collapse"
           android:title="@string/menu_collapse"
-          app:showAsAction="never" />
+          android:showAsAction="never" />
 </menu>
diff --git a/samples/SupportPercentDemos/res/layout/include_percent_frame_layout_content.xml b/samples/SupportPercentDemos/res/layout/include_percent_frame_layout_content.xml
index 2e5a659..091653b 100644
--- a/samples/SupportPercentDemos/res/layout/include_percent_frame_layout_content.xml
+++ b/samples/SupportPercentDemos/res/layout/include_percent_frame_layout_content.xml
@@ -18,12 +18,16 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto">
     <View
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
         app:layout_widthPercent="60%"
         app:layout_heightPercent="60%"
         app:layout_marginTopPercent="20%"
         app:layout_marginLeftPercent="20%"
         android:background="#FF0000" />
     <View
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
         android:layout_gravity="bottom|right"
         app:layout_widthPercent="20%"
         app:layout_heightPercent="20%"