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

Side by Side Diff: webrtc/examples/androidapp/src/org/appspot/apprtc/CallActivity.java

Issue 2670473004: Remove InlinedApi lint ignore. (Closed)
Patch Set: Immersive sticky only requires Kitkat not Lollipop. Created 3 years, 10 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
1 /* 1 /*
2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 package org.appspot.apprtc; 11 package org.appspot.apprtc;
12 12
13 import android.annotation.TargetApi;
13 import android.app.Activity; 14 import android.app.Activity;
14 import android.app.AlertDialog; 15 import android.app.AlertDialog;
15 import android.app.FragmentTransaction; 16 import android.app.FragmentTransaction;
16 import android.content.Context; 17 import android.content.Context;
17 import android.content.DialogInterface; 18 import android.content.DialogInterface;
18 import android.content.Intent; 19 import android.content.Intent;
19 import android.content.pm.PackageManager; 20 import android.content.pm.PackageManager;
20 import android.media.projection.MediaProjection; 21 import android.media.projection.MediaProjection;
21 import android.media.projection.MediaProjectionManager; 22 import android.media.projection.MediaProjectionManager;
22 import android.net.Uri; 23 import android.net.Uri;
24 import android.os.Build;
23 import android.os.Bundle; 25 import android.os.Bundle;
24 import android.os.Handler; 26 import android.os.Handler;
25 import android.util.DisplayMetrics; 27 import android.util.DisplayMetrics;
26 import android.util.Log; 28 import android.util.Log;
27 import android.view.View; 29 import android.view.View;
28 import android.view.Window; 30 import android.view.Window;
29 import android.view.WindowManager; 31 import android.view.WindowManager;
30 import android.view.WindowManager.LayoutParams; 32 import android.view.WindowManager.LayoutParams;
31 import android.widget.Toast; 33 import android.widget.Toast;
32 import java.io.IOException; 34 import java.io.IOException;
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 public void onCreate(Bundle savedInstanceState) { 186 public void onCreate(Bundle savedInstanceState) {
185 super.onCreate(savedInstanceState); 187 super.onCreate(savedInstanceState);
186 Thread.setDefaultUncaughtExceptionHandler(new UnhandledExceptionHandler(this )); 188 Thread.setDefaultUncaughtExceptionHandler(new UnhandledExceptionHandler(this ));
187 189
188 // Set window styles for fullscreen-window size. Needs to be done before 190 // Set window styles for fullscreen-window size. Needs to be done before
189 // adding content. 191 // adding content.
190 requestWindowFeature(Window.FEATURE_NO_TITLE); 192 requestWindowFeature(Window.FEATURE_NO_TITLE);
191 getWindow().addFlags(LayoutParams.FLAG_FULLSCREEN | LayoutParams.FLAG_KEEP_S CREEN_ON 193 getWindow().addFlags(LayoutParams.FLAG_FULLSCREEN | LayoutParams.FLAG_KEEP_S CREEN_ON
192 | LayoutParams.FLAG_DISMISS_KEYGUARD | LayoutParams.FLAG_SHOW_WHEN_LOCKE D 194 | LayoutParams.FLAG_DISMISS_KEYGUARD | LayoutParams.FLAG_SHOW_WHEN_LOCKE D
193 | LayoutParams.FLAG_TURN_SCREEN_ON); 195 | LayoutParams.FLAG_TURN_SCREEN_ON);
194 getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NA VIGATION 196 getWindow().getDecorView().setSystemUiVisibility(getSystemUiVisibility());
195 | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY) ;
196 setContentView(R.layout.activity_call); 197 setContentView(R.layout.activity_call);
197 198
198 iceConnected = false; 199 iceConnected = false;
199 signalingParameters = null; 200 signalingParameters = null;
200 scalingType = ScalingType.SCALE_ASPECT_FILL; 201 scalingType = ScalingType.SCALE_ASPECT_FILL;
201 202
202 // Create UI controls. 203 // Create UI controls.
203 localRender = (SurfaceViewRenderer) findViewById(R.id.local_video_view); 204 localRender = (SurfaceViewRenderer) findViewById(R.id.local_video_view);
204 remoteRenderScreen = (SurfaceViewRenderer) findViewById(R.id.remote_video_vi ew); 205 remoteRenderScreen = (SurfaceViewRenderer) findViewById(R.id.remote_video_vi ew);
205 localRenderLayout = (PercentFrameLayout) findViewById(R.id.local_video_layou t); 206 localRenderLayout = (PercentFrameLayout) findViewById(R.id.local_video_layou t);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 peerConnectionClient = PeerConnectionClient.getInstance(); 356 peerConnectionClient = PeerConnectionClient.getInstance();
356 if (loopback) { 357 if (loopback) {
357 PeerConnectionFactory.Options options = new PeerConnectionFactory.Options( ); 358 PeerConnectionFactory.Options options = new PeerConnectionFactory.Options( );
358 options.networkIgnoreMask = 0; 359 options.networkIgnoreMask = 0;
359 peerConnectionClient.setPeerConnectionFactoryOptions(options); 360 peerConnectionClient.setPeerConnectionFactoryOptions(options);
360 } 361 }
361 peerConnectionClient.createPeerConnectionFactory( 362 peerConnectionClient.createPeerConnectionFactory(
362 getApplicationContext(), peerConnectionParameters, CallActivity.this); 363 getApplicationContext(), peerConnectionParameters, CallActivity.this);
363 364
364 if (screencaptureEnabled) { 365 if (screencaptureEnabled) {
365 MediaProjectionManager mediaProjectionManager = 366 startScreenCapture();
366 (MediaProjectionManager) getApplication().getSystemService(
367 Context.MEDIA_PROJECTION_SERVICE);
368 startActivityForResult(
369 mediaProjectionManager.createScreenCaptureIntent(), CAPTURE_PERMISSION _REQUEST_CODE);
370 } else { 367 } else {
371 startCall(); 368 startCall();
372 } 369 }
373 } 370 }
374 371
372 @TargetApi(19)
373 private static int getSystemUiVisibility() {
374 int flags = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSC REEN;
375 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
376 flags |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
377 }
378 return flags;
379 }
380
381 @TargetApi(21)
382 private void startScreenCapture() {
383 MediaProjectionManager mediaProjectionManager =
384 (MediaProjectionManager) getApplication().getSystemService(
385 Context.MEDIA_PROJECTION_SERVICE);
386 startActivityForResult(
387 mediaProjectionManager.createScreenCaptureIntent(), CAPTURE_PERMISSION_R EQUEST_CODE);
388 }
389
375 @Override 390 @Override
376 public void onActivityResult(int requestCode, int resultCode, Intent data) { 391 public void onActivityResult(int requestCode, int resultCode, Intent data) {
377 if (requestCode != CAPTURE_PERMISSION_REQUEST_CODE) 392 if (requestCode != CAPTURE_PERMISSION_REQUEST_CODE)
378 return; 393 return;
379 mediaProjectionPermissionResultCode = resultCode; 394 mediaProjectionPermissionResultCode = resultCode;
380 mediaProjectionPermissionResultData = data; 395 mediaProjectionPermissionResultData = data;
381 startCall(); 396 startCall();
382 } 397 }
383 398
384 private boolean useCamera2() { 399 private boolean useCamera2() {
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 } 918 }
904 } 919 }
905 }); 920 });
906 } 921 }
907 922
908 @Override 923 @Override
909 public void onPeerConnectionError(final String description) { 924 public void onPeerConnectionError(final String description) {
910 reportError(description); 925 reportError(description);
911 } 926 }
912 } 927 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698