10.07.2015 Views

dissertation

dissertation

dissertation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

135++ /∗+ ∗ ( non−Javadoc )+ ∗+ ∗ @see android . content . BroadcastReceiver#onReceive ( android . content . Context ,+ ∗ android . content . I n t e n t )+ ∗/+ @Override+ p u b l i c void onReceive ( Context context , I n t e n t i n t e n t ) {+ // This i s the CyanogenMod 7 . 1 UsbManager , not the one from s t o c k+ // Android 2 . 3 or the backported Google API : s .+ Bundle e x t r a s = i n t e n t . g e t E x t r a s ( ) ;+ boolean usbConnected = e x t r a s . getBoolean ( UsbManager .USB CONNECTED) ;+ boolean adbEnabled = e x t r a s . g e t S t r i n g ( UsbManager .USB FUNCTION ADB)+ . e q u a l s ( UsbManager .USB FUNCTION ENABLED ) ;+ p r o v i d e r . onUSBDebug( usbConnected && adbEnabled ) ;+ }+ }++ p r i v a t e USBBroadcastReceiver r e c e i v e r = n u l l ;+ p r i v a t e I n t e n t F i l t e r f i l t e r = n u l l ;++ p r i v a t e boolean isDebugging = f a l s e ; // True w h i l e the c a b l e i s attached and USB debugging switched on++ p r i v a t e void onUSBDebug( boolean a c t i v e ) {+ isDebugging = a c t i v e ;+ }++ p r i v a t e S t r i n g getProcessNameFromPid ( i n t givenPid )+ {+ ActivityManager am = ( ActivityManager )+ getContext ( ) . g e t S y s t e m S e r v i c e ( A c t i v i t y . ACTIVITY SERVICE ) ;++ L i s t l s t A p p I n f o =+ am. getRunningAppProcesses ( ) ;++ f o r ( ActivityManager . RunningAppProcessInfo a i : l s t A p p I n f o ) {+ i f ( a i . pid == givenPid ) {+ r e t u r n a i . processName ;+ }

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!