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

Commit f3196cd7 authored by Derek Sollenberger's avatar Derek Sollenberger
Browse files

Add Plugin API for controling the device power states

This is an initial API that will allow the plugin to request to
keep the screen on.

companion change is in external/webkit

bug: 3331493
Change-Id: Ic18787e7ecd705a5b2e31a34ea884fd39ad9d11a
parent e38ba4ac
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -673,6 +673,7 @@ public class WebView extends AbsoluteLayout
    static final int AUTOFILL_COMPLETE                  = 134;

    static final int SELECT_AT                          = 135;
    static final int SCREEN_ON                          = 136;

    private static final int FIRST_PACKAGE_MSG_ID = SCROLL_TO_MSG_ID;
    private static final int LAST_PACKAGE_MSG_ID = SET_TOUCH_HIGHLIGHT_RECTS;
@@ -726,7 +727,8 @@ public class WebView extends AbsoluteLayout
        "SAVE_WEBARCHIVE_FINISHED", //       = 132;
        "SET_AUTOFILLABLE", //               = 133;
        "AUTOFILL_COMPLETE", //              = 134;
        "SELECT_AT" //                       = 135;
        "SELECT_AT", //                      = 135;
        "SCREEN_ON" //                       = 136;
    };

    // If the site doesn't use the viewport meta tag to specify the viewport,
@@ -7454,6 +7456,10 @@ public class WebView extends AbsoluteLayout
                    doMotionUp(msg.arg1, msg.arg2);
                    break;

                case SCREEN_ON:
                    setKeepScreenOn(msg.arg1 == 1);
                    break;

                case SHOW_FULLSCREEN: {
                    View view = (View) msg.obj;
                    int npp = msg.arg1;
+9 −0
Original line number Diff line number Diff line
@@ -2548,6 +2548,15 @@ final class WebViewCore {
        return mContext;
    }

    // called by JNI
    private void keepScreenOn(boolean screenOn) {
        if (mWebView != null) {
            Message message = mWebView.mPrivateHandler.obtainMessage(WebView.SCREEN_ON);
            message.arg1 = screenOn ? 1 : 0;
            message.sendToTarget();
        }
    }

    // called by JNI
    private Class<?> getPluginClass(String libName, String clsName) {