Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1220)

Side by Side Diff: shell/android/apk/src/org/chromium/mojo/shell/ViewportActivity.java

Issue 1280613003: Allow native_viewport to create new native windows on demand on Android. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.mojo.shell;
6
7 import android.app.Activity;
8 import android.app.UiModeManager;
9 import android.content.Intent;
10 import android.content.res.Configuration;
11 import android.os.Bundle;
12 import android.view.WindowManager;
13
14 import org.chromium.mojo.PlatformViewportAndroid;
15
16 /**
17 * Activity for displaying on the screen from the NativeViewportService.
18 */
19 public class ViewportActivity extends Activity {
20 private static final String TAG = "ViewportActivity";
21 private PlatformViewportAndroid mPlatformViewport;
22
23 @Override
24 protected void onCreate(final Bundle savedInstanceState) {
25 super.onCreate(savedInstanceState);
26
27 if (!PlatformViewportAndroid.newActivityStarted(this)) {
28 // We have not attached to a viewport, so there's no point continuin g.
29 finishAndRemoveTask();
30 }
31
32 // TODO(tonyg): Watch activities go back to the home screen within a
33 // couple of seconds of detaching from adb. So for demonstration purpose s,
34 // we just keep the screen on. Eventually we'll want a solution for
35 // allowing the screen to sleep without quitting the shell.
36 // TODO(etiennej): Verify the above is still true after the switch to a Service model.
37 UiModeManager uiModeManager = (UiModeManager) getSystemService(UI_MODE_S ERVICE);
38 if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_WAT CH) {
39 getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) ;
40 }
41 }
42
43 @Override
44 public void onNewIntent(Intent intent) {
45 super.onNewIntent(intent);
46 new RuntimeException("This activity instance should only ever receive on e intent.");
47 }
48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698