FreeRDP
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
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
11package com.freerdp.freerdpcore.application;
12
13import android.content.BroadcastReceiver;
14import android.content.Context;
15import android.content.Intent;
16import android.util.Log;
17
18public 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 GlobalApp.cancelDisconnectTimer();
29 }
30}