Blame client/Android/Studio/freeRDPCore/src/main/java/com/freerdp/freerdpcore/application/ScreenReceiver.java
|
Packit Service |
fa4841 |
/*
|
|
Packit Service |
fa4841 |
Helper class to receive notifications when the screen is turned on/off
|
|
Packit Service |
fa4841 |
|
|
Packit Service |
fa4841 |
Copyright 2013 Thincast Technologies GmbH, Author: Martin Fleisz
|
|
Packit Service |
fa4841 |
|
|
Packit Service |
fa4841 |
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
|
|
Packit Service |
fa4841 |
If a copy of the MPL was not distributed with this file, You can obtain one at
|
|
Packit Service |
fa4841 |
http://mozilla.org/MPL/2.0/.
|
|
Packit Service |
fa4841 |
*/
|
|
Packit Service |
fa4841 |
|
|
Packit Service |
fa4841 |
package com.freerdp.freerdpcore.application;
|
|
Packit Service |
fa4841 |
|
|
Packit Service |
fa4841 |
import android.content.BroadcastReceiver;
|
|
Packit Service |
fa4841 |
import android.content.Context;
|
|
Packit Service |
fa4841 |
import android.content.Intent;
|
|
Packit Service |
fa4841 |
import android.util.Log;
|
|
Packit Service |
fa4841 |
|
|
Packit Service |
fa4841 |
public class ScreenReceiver extends BroadcastReceiver
|
|
Packit Service |
fa4841 |
{
|
|
Packit Service |
fa4841 |
|
|
Packit Service |
fa4841 |
@Override public void onReceive(Context context, Intent intent)
|
|
Packit Service |
fa4841 |
{
|
|
Packit Service |
fa4841 |
GlobalApp app = (GlobalApp)context.getApplicationContext();
|
|
Packit Service |
fa4841 |
Log.v("ScreenReceiver", "Received action: " + intent.getAction());
|
|
Packit Service |
fa4841 |
if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF))
|
|
Packit Service |
fa4841 |
app.startDisconnectTimer();
|
|
Packit Service |
fa4841 |
else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON))
|
|
Packit Service |
fa4841 |
app.cancelDisconnectTimer();
|
|
Packit Service |
fa4841 |
}
|
|
Packit Service |
fa4841 |
}
|