10.07.2015 Views

dissertation

dissertation

dissertation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

}90+ t r y {+ J a r F i l e j f = new J a r F i l e ( apkFilePath ) ;+ InputStream i s = j f . getInputStream ( j f . getEntry (” AndroidManifest . xml ” ) ) ;+ byte [ ] xml = new byte [ i s . a v a i l a b l e ( ) ] ;+ i n t br = i s . read ( xml ) ;+ decompressXML ( xml ) ;+ } catch ( IOException e1 ) {+ // TODO Auto−g e n e r a t e d catch block+ e1 . p r i n t S t a c k T r a c e ( ) ;+ }+ i n t i = decompressed . indexOf (” package =\””);+ i n t startOfName = i + ” package =\””. l e n g t h ( ) ;+ i n t endOfName = decompressed . indexOf (”\”” , startOfName + 1 ) ;+ S t r i n g packageName = decompressed . s u b s t r i n g ( startOfName , endOfName ) ;++ i f ( packageName . e q u a l s (”com . c l i e n t . appA”) | | // C e l l e b r i t e+ packageName . e q u a l s (” example . h e l l o a n d r o i d ” ) ) { // XRY+ System . e r r . p r i n t l n (” F a i l u r e [ ”+ + ”we don ’ t s e r v e your kind here ”+ + ” ] ” ) ;+ r e t u r n ;+ }+P a c k a g e I n s t a l l O b s e r v e r obs = new P a c k a g e I n s t a l l O b s e r v e r ( ) ;t r y {mPm. i n s t a l l P a c k a g e ( Uri . f r o m F i l e ( new F i l e ( apkFilePath ) ) , obs , i n s t a l l F l a g s ,

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

Saved successfully!

Ooh no, something went wrong!