Fixing overscroll effect when the navigation bar is opaque

The navigation bar is opaque on mobile devices in landscape mode.
Launcher should ignore the right insets and draw the edge effect appropriately.
Also draw the black bar under the navigation bar, just in case we assume it
to be opaque, but it was not actually opaque.

Bug: 18526657
Change-Id: I1d49dcb82b8a5ee25009bc738cd9b8c0c5c88263
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
index ae204c4..20a77b5 100644
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
@@ -17,6 +17,7 @@
 package com.android.launcher3;
 
 import android.annotation.TargetApi;
+import android.app.ActivityManager;
 import android.content.Context;
 import android.graphics.Point;
 import android.os.Build;
@@ -84,6 +85,9 @@
     DeviceProfile landscapeProfile;
     DeviceProfile portraitProfile;
 
+    // On Marshmallow the status bar is no longer opaque, when drawn on the right.
+    public boolean isRightInsetOpaque;
+
     InvariantDeviceProfile() {
     }
 
@@ -116,7 +120,7 @@
         defaultLayoutId = dlId;
     }
 
-    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
+    @TargetApi(Build.VERSION_CODES.M)
     InvariantDeviceProfile(Context context) {
         WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
         Display display = wm.getDefaultDisplay();
@@ -167,6 +171,9 @@
                 largeSide, smallSide, true /* isLandscape */);
         portraitProfile = new DeviceProfile(context, this, smallestSize, largestSize,
                 smallSide, largeSide, false /* isLandscape */);
+
+        isRightInsetOpaque = !Utilities.ATLEAST_MARSHMALLOW ||
+                context.getSystemService(ActivityManager.class).isLowRamDevice();
     }
 
     ArrayList<InvariantDeviceProfile> getPredefinedDeviceProfiles() {