Source:
void saveCompatModes ( ) { java.util.HashMap < java.lang.String , java.lang.Integer > pkgs ; synchronized ( mService ) { pkgs = new java.util.HashMap < java.lang.String , java.lang.Integer > ( mPackages ) ; } java.io.FileOutputStream fos = null ; try { fos = mFile.startWrite ( ) ; org.xmlpull.v1.XmlSerializer out = new com.android.internal.util.FastXmlSerializer ( ) ; out.setOutput ( fos , "utf-8" ) ; out.startDocument ( null , true ) ; out.setFeature ( "http://xmlpull.org/v1/doc/features.html#indent-output" , true ) ; out.startTag ( null , "compat-packages" ) ; final android.content.pm.IPackageManager pm = android.app.AppGlobals.getPackageManager ( ) ; final int screenLayout = mService.mConfiguration.screenLayout ; final int smallestScreenWidthDp = mService.mConfiguration.smallestScreenWidthDp ; final java.util.Iterator < java.util.Map.Entry < java.lang.String , java.lang.Integer > > it = pkgs.entrySet ( ) . iterator ( ) ; while ( it.hasNext ( ) ) { java.util.Map.Entry < java.lang.String , java.lang.Integer > entry = it.next ( ) ; java.lang.String pkg = entry.getKey ( ) ; int mode = entry.getValue ( ) ; if ( mode == 0 ) { continue ; } android.content.pm.ApplicationInfo ai = null ; try { ai = pm.getApplicationInfo ( pkg , 0 , 0 ) ; } catch ( android.os.RemoteException e ) { } if ( ai == null ) { continue ; } android.content.res.CompatibilityInfo info = new android.content.res.CompatibilityInfo ( ai , screenLayout , smallestScreenWidthDp , false ) ; if ( info.alwaysSupportsScreen ( ) ) { continue ; } if ( info.neverSupportsScreen ( ) ) { continue ; } out.startTag ( null , "pkg" ) ; out.attribute ( null , "name" , pkg ) ; out.attribute ( null , "mode" , java.lang.Integer.toString ( mode ) ) ; out.endTag ( null , "pkg" ) ; } out.endTag ( null , "compat-packages" ) ; out.endDocument ( ) ; mFile.finishWrite ( fos ) ; } catch ( java.io.IOException e1 ) { android.util.Slog.w ( TAG , "Error writing compat packages" , e1 ) ; if ( fos != null ) { mFile.failWrite ( fos ) ; } } }

Target:
void saveCompatModes ( ) { java.util.HashMap < java.lang.String , java.lang.Integer > pkgs ; synchronized ( mService ) { pkgs = new java.util.HashMap < java.lang.String , java.lang.Integer > ( mPackages ) ; } java.io.FileOutputStream fos = null ; try { fos = mFile.startWrite ( ) ; org.xmlpull.v1.XmlSerializer out = new com.android.internal.util.FastXmlSerializer ( ) ; out.setOutput ( fos , java.nio.charset.StandardCharsets.UTF_8.name ( ) ) ; out.startDocument ( null , true ) ; out.setFeature ( "http://xmlpull.org/v1/doc/features.html#indent-output" , true ) ; out.startTag ( null , "compat-packages" ) ; final android.content.pm.IPackageManager pm = android.app.AppGlobals.getPackageManager ( ) ; final int screenLayout = mService.mConfiguration.screenLayout ; final int smallestScreenWidthDp = mService.mConfiguration.smallestScreenWidthDp ; final java.util.Iterator < java.util.Map.Entry < java.lang.String , java.lang.Integer > > it = pkgs.entrySet ( ) . iterator ( ) ; while ( it.hasNext ( ) ) { java.util.Map.Entry < java.lang.String , java.lang.Integer > entry = it.next ( ) ; java.lang.String pkg = entry.getKey ( ) ; int mode = entry.getValue ( ) ; if ( mode == 0 ) { continue ; } android.content.pm.ApplicationInfo ai = null ; try { ai = pm.getApplicationInfo ( pkg , 0 , 0 ) ; } catch ( android.os.RemoteException e ) { } if ( ai == null ) { continue ; } android.content.res.CompatibilityInfo info = new android.content.res.CompatibilityInfo ( ai , screenLayout , smallestScreenWidthDp , false ) ; if ( info.alwaysSupportsScreen ( ) ) { continue ; } if ( info.neverSupportsScreen ( ) ) { continue ; } out.startTag ( null , "pkg" ) ; out.attribute ( null , "name" , pkg ) ; out.attribute ( null , "mode" , java.lang.Integer.toString ( mode ) ) ; out.endTag ( null , "pkg" ) ; } out.endTag ( null , "compat-packages" ) ; out.endDocument ( ) ; mFile.finishWrite ( fos ) ; } catch ( java.io.IOException e1 ) { android.util.Slog.w ( TAG , "Error writing compat packages" , e1 ) ; if ( fos != null ) { mFile.failWrite ( fos ) ; } } }