Source:
private void writeApplicationRestrictionsLocked ( java.lang.String packageName , android.os.Bundle restrictions , int userId ) { java.io.FileOutputStream fos = null ; android.util.AtomicFile restrictionsFile = new android.util.AtomicFile ( new java.io.File ( android.os.Environment.getUserSystemDirectory ( userId ) , packageToRestrictionsFileName ( packageName ) ) ) ; try { fos = restrictionsFile.startWrite ( ) ; final java.io.BufferedOutputStream bos = new java.io.BufferedOutputStream ( fos ) ; final org.xmlpull.v1.XmlSerializer serializer = new com.android.internal.util.FastXmlSerializer ( ) ; serializer.setOutput ( bos , "utf-8" ) ; serializer.startDocument ( null , true ) ; serializer.setFeature ( "http://xmlpull.org/v1/doc/features.html#indent-output" , true ) ; serializer.startTag ( null , com.android.server.pm.UserManagerService.TAG_RESTRICTIONS ) ; for ( java.lang.String key : restrictions.keySet ( ) ) { java.lang.Object value = restrictions.get ( key ) ; serializer.startTag ( null , com.android.server.pm.UserManagerService.TAG_ENTRY ) ; serializer.attribute ( null , com.android.server.pm.UserManagerService.ATTR_KEY , key ) ; if ( value instanceof java.lang.Boolean ) { serializer.attribute ( null , com.android.server.pm.UserManagerService.ATTR_VALUE_TYPE , com.android.server.pm.UserManagerService.ATTR_TYPE_BOOLEAN ) ; serializer.text ( value.toString ( ) ) ; } else if ( value instanceof java.lang.Integer ) { serializer.attribute ( null , com.android.server.pm.UserManagerService.ATTR_VALUE_TYPE , com.android.server.pm.UserManagerService.ATTR_TYPE_INTEGER ) ; serializer.text ( value.toString ( ) ) ; } else if ( ( value == null ) || ( value instanceof java.lang.String ) ) { serializer.attribute ( null , com.android.server.pm.UserManagerService.ATTR_VALUE_TYPE , com.android.server.pm.UserManagerService.ATTR_TYPE_STRING ) ; serializer.text ( ( value != null ? ( ( java.lang.String ) ( value ) ) : "" ) ) ; } else { serializer.attribute ( null , com.android.server.pm.UserManagerService.ATTR_VALUE_TYPE , com.android.server.pm.UserManagerService.ATTR_TYPE_STRING_ARRAY ) ; java.lang.String [ ] values = ( ( java.lang.String [ ] ) ( value ) ) ; serializer.attribute ( null , com.android.server.pm.UserManagerService.ATTR_MULTIPLE , java.lang.Integer.toString ( values.length ) ) ; for ( java.lang.String choice : values ) { serializer.startTag ( null , com.android.server.pm.UserManagerService.TAG_VALUE ) ; serializer.text ( ( choice != null ? choice : "" ) ) ; serializer.endTag ( null , com.android.server.pm.UserManagerService.TAG_VALUE ) ; } } serializer.endTag ( null , com.android.server.pm.UserManagerService.TAG_ENTRY ) ; } serializer.endTag ( null , com.android.server.pm.UserManagerService.TAG_RESTRICTIONS ) ; serializer.endDocument ( ) ; restrictionsFile.finishWrite ( fos ) ; } catch ( java.lang.Exception e ) { restrictionsFile.failWrite ( fos ) ; android.util.Slog.e ( com.android.server.pm.UserManagerService.LOG_TAG , "Error writing application restrictions list" ) ; } }

Target:
private void writeApplicationRestrictionsLocked ( java.lang.String packageName , android.os.Bundle restrictions , int userId ) { java.io.FileOutputStream fos = null ; android.util.AtomicFile restrictionsFile = new android.util.AtomicFile ( new java.io.File ( android.os.Environment.getUserSystemDirectory ( userId ) , packageToRestrictionsFileName ( packageName ) ) ) ; try { fos = restrictionsFile.startWrite ( ) ; final java.io.BufferedOutputStream bos = new java.io.BufferedOutputStream ( fos ) ; final org.xmlpull.v1.XmlSerializer serializer = new com.android.internal.util.FastXmlSerializer ( ) ; serializer.setOutput ( bos , java.nio.charset.StandardCharsets.UTF_8.name ( ) ) ; serializer.startDocument ( null , true ) ; serializer.setFeature ( "http://xmlpull.org/v1/doc/features.html#indent-output" , true ) ; serializer.startTag ( null , com.android.server.pm.UserManagerService.TAG_RESTRICTIONS ) ; for ( java.lang.String key : restrictions.keySet ( ) ) { java.lang.Object value = restrictions.get ( key ) ; serializer.startTag ( null , com.android.server.pm.UserManagerService.TAG_ENTRY ) ; serializer.attribute ( null , com.android.server.pm.UserManagerService.ATTR_KEY , key ) ; if ( value instanceof java.lang.Boolean ) { serializer.attribute ( null , com.android.server.pm.UserManagerService.ATTR_VALUE_TYPE , com.android.server.pm.UserManagerService.ATTR_TYPE_BOOLEAN ) ; serializer.text ( value.toString ( ) ) ; } else if ( value instanceof java.lang.Integer ) { serializer.attribute ( null , com.android.server.pm.UserManagerService.ATTR_VALUE_TYPE , com.android.server.pm.UserManagerService.ATTR_TYPE_INTEGER ) ; serializer.text ( value.toString ( ) ) ; } else if ( ( value == null ) || ( value instanceof java.lang.String ) ) { serializer.attribute ( null , com.android.server.pm.UserManagerService.ATTR_VALUE_TYPE , com.android.server.pm.UserManagerService.ATTR_TYPE_STRING ) ; serializer.text ( ( value != null ? ( ( java.lang.String ) ( value ) ) : "" ) ) ; } else { serializer.attribute ( null , com.android.server.pm.UserManagerService.ATTR_VALUE_TYPE , com.android.server.pm.UserManagerService.ATTR_TYPE_STRING_ARRAY ) ; java.lang.String [ ] values = ( ( java.lang.String [ ] ) ( value ) ) ; serializer.attribute ( null , com.android.server.pm.UserManagerService.ATTR_MULTIPLE , java.lang.Integer.toString ( values.length ) ) ; for ( java.lang.String choice : values ) { serializer.startTag ( null , com.android.server.pm.UserManagerService.TAG_VALUE ) ; serializer.text ( ( choice != null ? choice : "" ) ) ; serializer.endTag ( null , com.android.server.pm.UserManagerService.TAG_VALUE ) ; } } serializer.endTag ( null , com.android.server.pm.UserManagerService.TAG_ENTRY ) ; } serializer.endTag ( null , com.android.server.pm.UserManagerService.TAG_RESTRICTIONS ) ; serializer.endDocument ( ) ; restrictionsFile.finishWrite ( fos ) ; } catch ( java.lang.Exception e ) { restrictionsFile.failWrite ( fos ) ; android.util.Slog.e ( com.android.server.pm.UserManagerService.LOG_TAG , "Error writing application restrictions list" ) ; } }