Android Open Source - ghetto-unlock Power Monitor






From Project

Back to project page ghetto-unlock.

License

The source code is released under:

Apache License

If you think the Android project ghetto-unlock listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.nick.ghettounlock;
/* w ww .  ja va2s  . c  om*/
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class PowerMonitor extends BroadcastReceiver {

    private static String TAG = PowerMonitor.class.getSimpleName();

    @Override
    public void onReceive(Context ctx, Intent intent) {
        Log.d(TAG, "received: " + intent);
        Log.d(TAG, "unlock on power connect: " + GhettoTrustAgent.isUnlockOnPowerConnect(ctx));

        if (!GhettoTrustAgent.isUnlockOnPowerConnect(ctx)) {
            return;
        }

        String action = intent.getAction();
        if (Intent.ACTION_POWER_CONNECTED.equals(action)) {
            Log.d(TAG, "Power connected. ");
            GhettoTrustAgent.sendGrantTrust(ctx, "GhettoTrustAgent::POWER_CONNECTED",
                    GhettoTrustAgentSettings.TRUST_DURATION_5MINS,
                    false);
        } else if (Intent.ACTION_POWER_DISCONNECTED.equals(action)) {
            Log.d(TAG, "Power disconnected");
            GhettoTrustAgent.sendRevokeTrust(ctx);
        }
    }
}




Java Source Code List

org.nick.ghettounlock.GhettoApp.java
org.nick.ghettounlock.GhettoNfcUnlockHandler.java
org.nick.ghettounlock.GhettoTrustAgentSettings.java
org.nick.ghettounlock.GhettoTrustAgent.java
org.nick.ghettounlock.PowerMonitor.java
org.nick.ghettounlock.WifiMonitor.java
org.nick.ghettounlock.muscle.Hex.java
org.nick.ghettounlock.muscle.MuscleCard.java
org.nick.ghettounlock.muscle.MuscleException.java
org.nick.ghettounlock.muscle.ResponseApdu.java