1 /*
2  * Copyright (C) 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.server.wm;
18 
19 import android.annotation.IntDef;
20 import android.annotation.Nullable;
21 import android.content.Context;
22 import android.graphics.Color;
23 
24 import com.android.internal.R;
25 
26 import java.lang.annotation.Retention;
27 import java.lang.annotation.RetentionPolicy;
28 
29 /** Reads letterbox configs from resources and controls their overrides at runtime. */
30 final class LetterboxConfiguration {
31 
32     /**
33      * Override of aspect ratio for fixed orientation letterboxing that is set via {@link
34      * com.android.internal.R.dimen.config_fixedOrientationLetterboxAspectRatio} will be ignored
35      * if it is <= this value.
36      */
37     static final float MIN_FIXED_ORIENTATION_LETTERBOX_ASPECT_RATIO = 1.0f;
38 
39     /** Enum for Letterbox background type. */
40     @Retention(RetentionPolicy.SOURCE)
41     @IntDef({LETTERBOX_BACKGROUND_SOLID_COLOR, LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND,
42             LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND_FLOATING, LETTERBOX_BACKGROUND_WALLPAPER})
43     @interface LetterboxBackgroundType {};
44     /** Solid background using color specified in R.color.config_letterboxBackgroundColor. */
45     static final int LETTERBOX_BACKGROUND_SOLID_COLOR = 0;
46 
47     /** Color specified in R.attr.colorBackground for the letterboxed application. */
48     static final int LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND = 1;
49 
50     /** Color specified in R.attr.colorBackgroundFloating for the letterboxed application. */
51     static final int LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND_FLOATING = 2;
52 
53     /** Using wallpaper as a background which can be blurred or dimmed with dark scrim. */
54     static final int LETTERBOX_BACKGROUND_WALLPAPER = 3;
55 
56     /**
57      * Enum for Letterbox reachability position types.
58      *
59      * <p>Order from left to right is important since it's used in {@link
60      * #movePositionForReachabilityToNextRightStop} and {@link
61      * #movePositionForReachabilityToNextLeftStop}.
62      */
63     @Retention(RetentionPolicy.SOURCE)
64     @IntDef({LETTERBOX_REACHABILITY_POSITION_LEFT, LETTERBOX_REACHABILITY_POSITION_CENTER,
65             LETTERBOX_REACHABILITY_POSITION_RIGHT})
66     @interface LetterboxReachabilityPosition {};
67 
68     /** Letterboxed app window is aligned to the left side. */
69     static final int LETTERBOX_REACHABILITY_POSITION_LEFT = 0;
70 
71     /** Letterboxed app window is positioned in the horizontal center. */
72     static final int LETTERBOX_REACHABILITY_POSITION_CENTER = 1;
73 
74     /** Letterboxed app window is aligned to the right side. */
75     static final int LETTERBOX_REACHABILITY_POSITION_RIGHT = 2;
76 
77     final Context mContext;
78 
79     // Aspect ratio of letterbox for fixed orientation, values <=
80     // MIN_FIXED_ORIENTATION_LETTERBOX_ASPECT_RATIO will be ignored.
81     private float mFixedOrientationLetterboxAspectRatio;
82 
83     // Corners radius for activities presented in the letterbox mode, values < 0 will be ignored.
84     private int mLetterboxActivityCornersRadius;
85 
86     // Color for {@link #LETTERBOX_BACKGROUND_SOLID_COLOR} letterbox background type.
87     @Nullable private Color mLetterboxBackgroundColorOverride;
88 
89     // Color resource id for {@link #LETTERBOX_BACKGROUND_SOLID_COLOR} letterbox background type.
90     @Nullable private Integer mLetterboxBackgroundColorResourceIdOverride;
91 
92     @LetterboxBackgroundType
93     private int mLetterboxBackgroundType;
94 
95     // Blur radius for LETTERBOX_BACKGROUND_WALLPAPER option in mLetterboxBackgroundType.
96     // Values <= 0 are ignored and 0 is used instead.
97     private int mLetterboxBackgroundWallpaperBlurRadius;
98 
99     // Alpha of a black scrim shown over wallpaper letterbox background when
100     // LETTERBOX_BACKGROUND_WALLPAPER option is selected for mLetterboxBackgroundType.
101     // Values < 0 or >= 1 are ignored and 0.0 (transparent) is used instead.
102     private float mLetterboxBackgroundWallpaperDarkScrimAlpha;
103 
104     // Horizontal position of a center of the letterboxed app window. 0 corresponds to the left
105     // side of the screen and 1.0 to the right side.
106     private float mLetterboxHorizontalPositionMultiplier;
107 
108     // Default horizontal position the letterboxed app window when reachability is enabled and
109     // an app is fullscreen in landscape device orientatio.
110     // It is used as a starting point for mLetterboxPositionForReachability.
111     @LetterboxReachabilityPosition
112     private int mDefaultPositionForReachability;
113 
114     // Whether reachability repositioning is allowed for letterboxed fullscreen apps in landscape
115     // device orientation.
116     private boolean mIsReachabilityEnabled;
117 
118     // Horizontal position of a center of the letterboxed app window which is global to prevent
119     // "jumps" when switching between letterboxed apps. It's updated to reposition the app window
120     // in response to a double tap gesture (see LetterboxUiController#handleDoubleTap). Used in
121     // LetterboxUiController#getHorizontalPositionMultiplier which is called from
122     // ActivityRecord#updateResolvedBoundsHorizontalPosition.
123     // TODO(b/199426138): Global reachability setting causes a jump when resuming an app from
124     // Overview after changing position in another app.
125     @LetterboxReachabilityPosition
126     private volatile int mLetterboxPositionForReachability;
127 
LetterboxConfiguration(Context systemUiContext)128     LetterboxConfiguration(Context systemUiContext) {
129         mContext = systemUiContext;
130         mFixedOrientationLetterboxAspectRatio = mContext.getResources().getFloat(
131                 R.dimen.config_fixedOrientationLetterboxAspectRatio);
132         mLetterboxActivityCornersRadius = mContext.getResources().getInteger(
133                 R.integer.config_letterboxActivityCornersRadius);
134         mLetterboxBackgroundType = readLetterboxBackgroundTypeFromConfig(mContext);
135         mLetterboxBackgroundWallpaperBlurRadius = mContext.getResources().getDimensionPixelSize(
136                 R.dimen.config_letterboxBackgroundWallpaperBlurRadius);
137         mLetterboxBackgroundWallpaperDarkScrimAlpha = mContext.getResources().getFloat(
138                 R.dimen.config_letterboxBackgroundWallaperDarkScrimAlpha);
139         mLetterboxHorizontalPositionMultiplier = mContext.getResources().getFloat(
140                 R.dimen.config_letterboxHorizontalPositionMultiplier);
141         mIsReachabilityEnabled = mContext.getResources().getBoolean(
142                 R.bool.config_letterboxIsReachabilityEnabled);
143         mDefaultPositionForReachability = readLetterboxReachabilityPositionFromConfig(mContext);
144         mLetterboxPositionForReachability = mDefaultPositionForReachability;
145     }
146 
147     /**
148      * Overrides the aspect ratio of letterbox for fixed orientation. If given value is <= {@link
149      * #MIN_FIXED_ORIENTATION_LETTERBOX_ASPECT_RATIO}, both it and a value of {@link
150      * com.android.internal.R.dimen.config_fixedOrientationLetterboxAspectRatio} will be ignored and
151      * the framework implementation will be used to determine the aspect ratio.
152      */
setFixedOrientationLetterboxAspectRatio(float aspectRatio)153     void setFixedOrientationLetterboxAspectRatio(float aspectRatio) {
154         mFixedOrientationLetterboxAspectRatio = aspectRatio;
155     }
156 
157     /**
158      * Resets the aspect ratio of letterbox for fixed orientation to {@link
159      * com.android.internal.R.dimen.config_fixedOrientationLetterboxAspectRatio}.
160      */
resetFixedOrientationLetterboxAspectRatio()161     void resetFixedOrientationLetterboxAspectRatio() {
162         mFixedOrientationLetterboxAspectRatio = mContext.getResources().getFloat(
163                 com.android.internal.R.dimen.config_fixedOrientationLetterboxAspectRatio);
164     }
165 
166     /**
167      * Gets the aspect ratio of letterbox for fixed orientation.
168      */
getFixedOrientationLetterboxAspectRatio()169     float getFixedOrientationLetterboxAspectRatio() {
170         return mFixedOrientationLetterboxAspectRatio;
171     }
172 
173     /**
174      * Overrides corners raidus for activities presented in the letterbox mode. If given value < 0,
175      * both it and a value of {@link
176      * com.android.internal.R.integer.config_letterboxActivityCornersRadius} will be ignored and
177      * corners of the activity won't be rounded.
178      */
setLetterboxActivityCornersRadius(int cornersRadius)179     void setLetterboxActivityCornersRadius(int cornersRadius) {
180         mLetterboxActivityCornersRadius = cornersRadius;
181     }
182 
183     /**
184      * Resets corners raidus for activities presented in the letterbox mode to {@link
185      * com.android.internal.R.integer.config_letterboxActivityCornersRadius}.
186      */
resetLetterboxActivityCornersRadius()187     void resetLetterboxActivityCornersRadius() {
188         mLetterboxActivityCornersRadius = mContext.getResources().getInteger(
189                 com.android.internal.R.integer.config_letterboxActivityCornersRadius);
190     }
191 
192     /**
193      * Whether corners of letterboxed activities are rounded.
194      */
isLetterboxActivityCornersRounded()195     boolean isLetterboxActivityCornersRounded() {
196         return getLetterboxActivityCornersRadius() != 0;
197     }
198 
199     /**
200      * Gets corners raidus for activities presented in the letterbox mode.
201      */
getLetterboxActivityCornersRadius()202     int getLetterboxActivityCornersRadius() {
203         return mLetterboxActivityCornersRadius;
204     }
205 
206     /**
207      * Gets color of letterbox background which is used when {@link
208      * #getLetterboxBackgroundType()} is {@link #LETTERBOX_BACKGROUND_SOLID_COLOR} or as
209      * fallback for other backfround types.
210      */
getLetterboxBackgroundColor()211     Color getLetterboxBackgroundColor() {
212         if (mLetterboxBackgroundColorOverride != null) {
213             return mLetterboxBackgroundColorOverride;
214         }
215         int colorId = mLetterboxBackgroundColorResourceIdOverride != null
216                 ? mLetterboxBackgroundColorResourceIdOverride
217                 : R.color.config_letterboxBackgroundColor;
218         // Query color dynamically because material colors extracted from wallpaper are updated
219         // when wallpaper is changed.
220         return Color.valueOf(mContext.getResources().getColor(colorId));
221     }
222 
223 
224     /**
225      * Sets color of letterbox background which is used when {@link
226      * #getLetterboxBackgroundType()} is {@link #LETTERBOX_BACKGROUND_SOLID_COLOR} or as
227      * fallback for other backfround types.
228      */
setLetterboxBackgroundColor(Color color)229     void setLetterboxBackgroundColor(Color color) {
230         mLetterboxBackgroundColorOverride = color;
231     }
232 
233     /**
234      * Sets color ID of letterbox background which is used when {@link
235      * #getLetterboxBackgroundType()} is {@link #LETTERBOX_BACKGROUND_SOLID_COLOR} or as
236      * fallback for other backfround types.
237      */
setLetterboxBackgroundColorResourceId(int colorId)238     void setLetterboxBackgroundColorResourceId(int colorId) {
239         mLetterboxBackgroundColorResourceIdOverride = colorId;
240     }
241 
242     /**
243      * Resets color of letterbox background to {@link
244      * com.android.internal.R.color.config_letterboxBackgroundColor}.
245      */
resetLetterboxBackgroundColor()246     void resetLetterboxBackgroundColor() {
247         mLetterboxBackgroundColorOverride = null;
248         mLetterboxBackgroundColorResourceIdOverride = null;
249     }
250 
251     /**
252      * Gets {@link LetterboxBackgroundType} specified in {@link
253      * com.android.internal.R.integer.config_letterboxBackgroundType}.
254      */
255     @LetterboxBackgroundType
getLetterboxBackgroundType()256     int getLetterboxBackgroundType() {
257         return mLetterboxBackgroundType;
258     }
259 
260     /** Sets letterbox background type. */
setLetterboxBackgroundType(@etterboxBackgroundType int backgroundType)261     void setLetterboxBackgroundType(@LetterboxBackgroundType int backgroundType) {
262         mLetterboxBackgroundType = backgroundType;
263     }
264 
265     /**
266      * Resets cletterbox background type to {@link
267      * com.android.internal.R.integer.config_letterboxBackgroundType}.
268      */
resetLetterboxBackgroundType()269     void resetLetterboxBackgroundType() {
270         mLetterboxBackgroundType = readLetterboxBackgroundTypeFromConfig(mContext);
271     }
272 
273     /** Returns a string representing the given {@link LetterboxBackgroundType}. */
letterboxBackgroundTypeToString( @etterboxBackgroundType int backgroundType)274     static String letterboxBackgroundTypeToString(
275             @LetterboxBackgroundType int backgroundType) {
276         switch (backgroundType) {
277             case LETTERBOX_BACKGROUND_SOLID_COLOR:
278                 return "LETTERBOX_BACKGROUND_SOLID_COLOR";
279             case LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND:
280                 return "LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND";
281             case LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND_FLOATING:
282                 return "LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND_FLOATING";
283             case LETTERBOX_BACKGROUND_WALLPAPER:
284                 return "LETTERBOX_BACKGROUND_WALLPAPER";
285             default:
286                 return "unknown=" + backgroundType;
287         }
288     }
289 
290     @LetterboxBackgroundType
readLetterboxBackgroundTypeFromConfig(Context context)291     private static int readLetterboxBackgroundTypeFromConfig(Context context) {
292         int backgroundType = context.getResources().getInteger(
293                 com.android.internal.R.integer.config_letterboxBackgroundType);
294         return backgroundType == LETTERBOX_BACKGROUND_SOLID_COLOR
295                     || backgroundType == LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND
296                     || backgroundType == LETTERBOX_BACKGROUND_APP_COLOR_BACKGROUND_FLOATING
297                     || backgroundType == LETTERBOX_BACKGROUND_WALLPAPER
298                     ? backgroundType : LETTERBOX_BACKGROUND_SOLID_COLOR;
299     }
300 
301     /**
302      * Overrides alpha of a black scrim shown over wallpaper for {@link
303      * #LETTERBOX_BACKGROUND_WALLPAPER} option in {@link mLetterboxBackgroundType}.
304      *
305      * <p>If given value is < 0 or >= 1, both it and a value of {@link
306      * com.android.internal.R.dimen.config_letterboxBackgroundWallaperDarkScrimAlpha} are ignored
307      * and 0.0 (transparent) is instead.
308      */
setLetterboxBackgroundWallpaperDarkScrimAlpha(float alpha)309     void setLetterboxBackgroundWallpaperDarkScrimAlpha(float alpha) {
310         mLetterboxBackgroundWallpaperDarkScrimAlpha = alpha;
311     }
312 
313     /**
314      * Resets alpha of a black scrim shown over wallpaper letterbox background to {@link
315      * com.android.internal.R.dimen.config_letterboxBackgroundWallaperDarkScrimAlpha}.
316      */
resetLetterboxBackgroundWallpaperDarkScrimAlpha()317     void resetLetterboxBackgroundWallpaperDarkScrimAlpha() {
318         mLetterboxBackgroundWallpaperDarkScrimAlpha = mContext.getResources().getFloat(
319                 com.android.internal.R.dimen.config_letterboxBackgroundWallaperDarkScrimAlpha);
320     }
321 
322     /**
323      * Gets alpha of a black scrim shown over wallpaper letterbox background.
324      */
getLetterboxBackgroundWallpaperDarkScrimAlpha()325     float getLetterboxBackgroundWallpaperDarkScrimAlpha() {
326         return mLetterboxBackgroundWallpaperDarkScrimAlpha;
327     }
328 
329     /**
330      * Overrides blur radius for {@link #LETTERBOX_BACKGROUND_WALLPAPER} option in
331      * {@link mLetterboxBackgroundType}.
332      *
333      * <p> If given value <= 0, both it and a value of {@link
334      * com.android.internal.R.dimen.config_letterboxBackgroundWallpaperBlurRadius} are ignored
335      * and 0 is used instead.
336      */
setLetterboxBackgroundWallpaperBlurRadius(int radius)337     void setLetterboxBackgroundWallpaperBlurRadius(int radius) {
338         mLetterboxBackgroundWallpaperBlurRadius = radius;
339     }
340 
341     /**
342      * Resets blur raidus for {@link #LETTERBOX_BACKGROUND_WALLPAPER} option in {@link
343      * mLetterboxBackgroundType} to {@link
344      * com.android.internal.R.dimen.config_letterboxBackgroundWallpaperBlurRadius}.
345      */
resetLetterboxBackgroundWallpaperBlurRadius()346     void resetLetterboxBackgroundWallpaperBlurRadius() {
347         mLetterboxBackgroundWallpaperBlurRadius = mContext.getResources().getDimensionPixelSize(
348                 com.android.internal.R.dimen.config_letterboxBackgroundWallpaperBlurRadius);
349     }
350 
351     /**
352      * Gets blur raidus for {@link #LETTERBOX_BACKGROUND_WALLPAPER} option in {@link
353      * mLetterboxBackgroundType}.
354      */
getLetterboxBackgroundWallpaperBlurRadius()355     int getLetterboxBackgroundWallpaperBlurRadius() {
356         return mLetterboxBackgroundWallpaperBlurRadius;
357     }
358 
359     /*
360      * Gets horizontal position of a center of the letterboxed app window specified
361      * in {@link com.android.internal.R.dimen.config_letterboxHorizontalPositionMultiplier}.
362      * 0 corresponds to the left side of the screen and 1 to the right side.
363      */
getLetterboxHorizontalPositionMultiplier()364     float getLetterboxHorizontalPositionMultiplier() {
365         return (mLetterboxHorizontalPositionMultiplier < 0.0f
366                 || mLetterboxHorizontalPositionMultiplier > 1.0f)
367                         // Default to central position if invalid value is provided.
368                         ? 0.5f : mLetterboxHorizontalPositionMultiplier;
369     }
370 
371     /**
372      * Overrides horizontal position of a center of the letterboxed app window. If given value < 0
373      * or > 1, then it and a value of {@link
374      * com.android.internal.R.dimen.config_letterboxHorizontalPositionMultiplier} are ignored and
375      * central position (0.5) is used.
376      */
setLetterboxHorizontalPositionMultiplier(float multiplier)377     void setLetterboxHorizontalPositionMultiplier(float multiplier) {
378         mLetterboxHorizontalPositionMultiplier = multiplier;
379     }
380 
381     /**
382      * Resets horizontal position of a center of the letterboxed app window to {@link
383      * com.android.internal.R.dimen.config_letterboxHorizontalPositionMultiplier}.
384      */
resetLetterboxHorizontalPositionMultiplier()385     void resetLetterboxHorizontalPositionMultiplier() {
386         mLetterboxHorizontalPositionMultiplier = mContext.getResources().getFloat(
387                 com.android.internal.R.dimen.config_letterboxHorizontalPositionMultiplier);
388     }
389 
390     /*
391      * Whether reachability repositioning is allowed for letterboxed fullscreen apps in landscape
392      * device orientation.
393      */
getIsReachabilityEnabled()394     boolean getIsReachabilityEnabled() {
395         return mIsReachabilityEnabled;
396     }
397 
398     /**
399      * Overrides whether reachability repositioning is allowed for letterboxed fullscreen apps in
400      * landscape device orientation.
401      */
setIsReachabilityEnabled(boolean enabled)402     void setIsReachabilityEnabled(boolean enabled) {
403         mIsReachabilityEnabled = enabled;
404     }
405 
406     /**
407      * Resets whether reachability repositioning is allowed for letterboxed fullscreen apps in
408      * landscape device orientation to {@link R.bool.config_letterboxIsReachabilityEnabled}.
409      */
resetIsReachabilityEnabled()410     void resetIsReachabilityEnabled() {
411         mIsReachabilityEnabled = mContext.getResources().getBoolean(
412                 R.bool.config_letterboxIsReachabilityEnabled);
413     }
414 
415     /*
416      * Gets default horizontal position of the letterboxed app window when reachability is enabled.
417      * Specified in {@link R.integer.config_letterboxDefaultPositionForReachability}.
418      */
419     @LetterboxReachabilityPosition
getDefaultPositionForReachability()420     int getDefaultPositionForReachability() {
421         return mDefaultPositionForReachability;
422     }
423 
424     /**
425      * Overrides default horizonal position of the letterboxed app window when reachability
426      * is enabled.
427      */
setDefaultPositionForReachability(@etterboxReachabilityPosition int position)428     void setDefaultPositionForReachability(@LetterboxReachabilityPosition int position) {
429         mDefaultPositionForReachability = position;
430     }
431 
432     /**
433      * Resets default horizontal position of the letterboxed app window when reachability is
434      * enabled to {@link R.integer.config_letterboxDefaultPositionForReachability}.
435      */
resetDefaultPositionForReachability()436     void resetDefaultPositionForReachability() {
437         mDefaultPositionForReachability = readLetterboxReachabilityPositionFromConfig(mContext);
438     }
439 
440     @LetterboxReachabilityPosition
readLetterboxReachabilityPositionFromConfig(Context context)441     private static int readLetterboxReachabilityPositionFromConfig(Context context) {
442         int position = context.getResources().getInteger(
443                 R.integer.config_letterboxDefaultPositionForReachability);
444         return position == LETTERBOX_REACHABILITY_POSITION_LEFT
445                     || position == LETTERBOX_REACHABILITY_POSITION_CENTER
446                     || position == LETTERBOX_REACHABILITY_POSITION_RIGHT
447                     ? position : LETTERBOX_REACHABILITY_POSITION_CENTER;
448     }
449 
450     /*
451      * Gets horizontal position of a center of the letterboxed app window when reachability
452      * is enabled specified. 0 corresponds to the left side of the screen and 1 to the right side.
453      *
454      * <p>The position multiplier is changed after each double tap in the letterbox area.
455      */
getHorizontalMultiplierForReachability()456     float getHorizontalMultiplierForReachability() {
457         switch (mLetterboxPositionForReachability) {
458             case LETTERBOX_REACHABILITY_POSITION_LEFT:
459                 return 0.0f;
460             case LETTERBOX_REACHABILITY_POSITION_CENTER:
461                 return 0.5f;
462             case LETTERBOX_REACHABILITY_POSITION_RIGHT:
463                 return 1.0f;
464             default:
465                 throw new AssertionError(
466                     "Unexpected letterbox position type: " + mLetterboxPositionForReachability);
467         }
468     }
469 
470     /** Returns a string representing the given {@link LetterboxReachabilityPosition}. */
letterboxReachabilityPositionToString( @etterboxReachabilityPosition int position)471     static String letterboxReachabilityPositionToString(
472             @LetterboxReachabilityPosition int position) {
473         switch (position) {
474             case LETTERBOX_REACHABILITY_POSITION_LEFT:
475                 return "LETTERBOX_REACHABILITY_POSITION_LEFT";
476             case LETTERBOX_REACHABILITY_POSITION_CENTER:
477                 return "LETTERBOX_REACHABILITY_POSITION_CENTER";
478             case LETTERBOX_REACHABILITY_POSITION_RIGHT:
479                 return "LETTERBOX_REACHABILITY_POSITION_RIGHT";
480             default:
481                 throw new AssertionError(
482                     "Unexpected letterbox position type: " + position);
483         }
484     }
485 
486     /**
487      * Changes letterbox position for reachability to the next available one on the right side.
488      */
movePositionForReachabilityToNextRightStop()489     void movePositionForReachabilityToNextRightStop() {
490         mLetterboxPositionForReachability = Math.min(
491                 mLetterboxPositionForReachability + 1, LETTERBOX_REACHABILITY_POSITION_RIGHT);
492     }
493 
494     /**
495      * Changes letterbox position for reachability to the next available one on the left side.
496      */
movePositionForReachabilityToNextLeftStop()497     void movePositionForReachabilityToNextLeftStop() {
498         mLetterboxPositionForReachability = Math.max(mLetterboxPositionForReachability - 1, 0);
499     }
500 
501 }
502