1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
content / public / android / java / src / org / chromium / content_public / browser / ScreenOrientationProvider.java [blame]
// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.content_public.browser;
import androidx.annotation.Nullable;
import org.chromium.content.browser.ScreenOrientationProviderImpl;
import org.chromium.ui.base.WindowAndroid;
/**
* Interface providing the access to C++ ScreenOrientationProvider.
* TODO(boliu): This interface working with WindowAndroid does not support the use case
* when an Activity (and WindowAndroid) is recreated on rotation.
*/
public interface ScreenOrientationProvider {
static ScreenOrientationProvider getInstance() {
return ScreenOrientationProviderImpl.getInstance();
}
/**
* Locks screen rotation to a given orientation.
* @param window Window to lock rotation on.
* @param webScreenOrientation Screen orientation.
*/
void lockOrientation(@Nullable WindowAndroid window, byte webScreenOrientation);
/**
* Unlocks screen orientation.
* @param window Window to unlock rotation on.
*/
void unlockOrientation(@Nullable WindowAndroid window);
/** Delays screen orientation requests for the given window. */
void delayOrientationRequests(WindowAndroid window);
/** Runs delayed screen orientation requests for the given window. */
void runDelayedOrientationRequests(WindowAndroid window);
void setOrientationDelegate(ScreenOrientationDelegate delegate);
/**
* Sets a default screen orientation for a given window.
* @param window Window to lock rotation on.
* @param defaultWebOrientation a default screen orientation for the window.
*/
void setOverrideDefaultOrientation(WindowAndroid window, byte defaultWebOrientation);
}