FreeRDP
ScreenReceiver.java
1 /*
2  Helper class to receive notifications when the screen is turned on/off
3 
4  Copyright 2013 Thincast Technologies GmbH, Author: Martin Fleisz
5 
6  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
7  If a copy of the MPL was not distributed with this file, You can obtain one at
8  http://mozilla.org/MPL/2.0/.
9 */
10 
11 package com.freerdp.freerdpcore.application;
12 
13 import android.content.BroadcastReceiver;
14 import android.content.Context;
15 import android.content.Intent;
16 import android.util.Log;
17 
18 public class ScreenReceiver extends BroadcastReceiver
19 {
20 
21  @Override public void onReceive(Context context, Intent intent)
22  {
23  GlobalApp app = (GlobalApp)context.getApplicationContext();
24  Log.v("ScreenReceiver", "Received action: " + intent.getAction());
25  if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF))
26  app.startDisconnectTimer();
27  else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON))
28  app.cancelDisconnectTimer();
29  }
30 }