// Path: ui/src/org/chromium/ui/LocalizationUtils.java
// @JNINamespace("l10n_util")
// public class LocalizationUtils {
// 
//     // This is mirrored from base/i18n/rtl.h. Please keep in sync.
//     public static final int UNKNOWN_DIRECTION = 0;
//     public static final int RIGHT_TO_LEFT = 1;
//     public static final int LEFT_TO_RIGHT = 2;
// 
//     private LocalizationUtils() { /* cannot be instantiated */ }
// 
//     /**
//      * @return the default locale, translating Android deprecated
//      * language codes into the modern ones used by Chromium.
//      */
//     @CalledByNative
//     public static String getDefaultLocale() {
//         Locale locale = Locale.getDefault();
//         String language = locale.getLanguage();
//         String country = locale.getCountry();
// 
//         // Android uses deprecated lanuages codes for Hebrew and Indonesian but Chromium uses the
//         // updated codes. Also, Android uses "tl" while Chromium uses "fil" for Tagalog/Filipino.
//         // So apply a mapping.
//         // See http://developer.android.com/reference/java/util/Locale.html
//         if ("iw".equals(language)) {
//             language = "he";
//         } else if ("in".equals(language)) {
//             language = "id";
//         } else if ("tl".equals(language)) {
//             language = "fil";
//         }
//         return country.isEmpty() ? language : language + "-" + country;
//     }
// 
//     @CalledByNative
//     private static Locale getJavaLocale(String language, String country, String variant) {
//         return new Locale(language, country, variant);
//     }
// 
//     @CalledByNative
//     private static String getDisplayNameForLocale(Locale locale, Locale displayLocale) {
//         return locale.getDisplayName(displayLocale);
//     }
// 
//     /**
//      * @return true if the system default layout direction is RTL, false otherwise.
//      *         RTL layout support is from Jelly Bean MR1, so if the version is lower
//      *         than that, it is always false.
//      */
//     public static boolean isSystemLayoutDirectionRtl() {
//         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
//             return TextUtils.getLayoutDirectionFromLocale(Locale.getDefault())
//                     == View.LAYOUT_DIRECTION_RTL;
//         }
//         return false;
//     }
// 
//     /**
//      * Jni binding to base::i18n::IsRTL.
//      * @return true if the current locale is right to left.
//      */
//     public static boolean isRtl() {
//         return nativeIsRTL();
//     }
// 
//     /**
//      * Jni binding to base::i18n::GetFirstStrongCharacterDirection
//      * @param string String to decide the direction.
//      * @return One of the UNKNOWN_DIRECTION, RIGHT_TO_LEFT, and LEFT_TO_RIGHT.
//      */
//     public static int getFirstStrongCharacterDirection(String string) {
//         return nativeGetFirstStrongCharacterDirection(string);
//     }
// 
//     private static native boolean nativeIsRTL();
// 
//     private static native int nativeGetFirstStrongCharacterDirection(String string);
// }


import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.AssetManager;
import android.os.AsyncTask;
import android.preference.PreferenceManager;
import android.util.Log;
import org.chromium.base.PathUtils;
import org.chromium.ui.LocalizationUtils;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashSet;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.regex.Pattern;
            deleteFiles(mContext);
        }
        catch (InterruptedException e3) {
            deleteFiles(mContext);
        }
    }

    // This will extract the application pak resources in an
    // AsyncTask. Call waitForCompletion() at the point resources
    // are needed to block until the task completes.
    public void startExtractingResources() {
        if (mExtractTask != null) {
            return;
        }

        if (shouldSkipPakExtraction()) {
            return;
        }

        mExtractTask = new ExtractTask();
        mExtractTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    }

    public static File getOutputDirFromContext(Context context) {
        return new File(PathUtils.getDataDirectory(context.getApplicationContext()), "paks");
    }

    public static void deleteFiles(Context context) {
        File dir = getOutputDirFromContext(context);
        if (dir.exists()) {
// Path: ui/src/org/chromium/ui/LocalizationUtils.java
// @JNINamespace("l10n_util")
// public class LocalizationUtils {
// 
//     // This is mirrored from base/i18n/rtl.h. Please keep in sync.
//     public static final int UNKNOWN_DIRECTION = 0;
//     public static final int RIGHT_TO_LEFT = 1;
//     public static final int LEFT_TO_RIGHT = 2;
// 
//     private LocalizationUtils() { /* cannot be instantiated */ }
// 
//     /**
//      * @return the default locale, translating Android deprecated
//      * language codes into the modern ones used by Chromium.
//      */
//     @CalledByNative
//     public static String getDefaultLocale() {
//         Locale locale = Locale.getDefault();
//         String language = locale.getLanguage();
//         String country = locale.getCountry();
// 
//         // Android uses deprecated lanuages codes for Hebrew and Indonesian but Chromium uses the
//         // updated codes. Also, Android uses "tl" while Chromium uses "fil" for Tagalog/Filipino.
//         // So apply a mapping.
//         // See http://developer.android.com/reference/java/util/Locale.html
//         if ("iw".equals(language)) {
//             language = "he";
//         } else if ("in".equals(language)) {
//             language = "id";
//         } else if ("tl".equals(language)) {
//             language = "fil";
//         }
//         return country.isEmpty() ? language : language + "-" + country;
//     }
// 
//     @CalledByNative
//     private static Locale getJavaLocale(String language, String country, String variant) {
//         return new Locale(language, country, variant);
//     }
// 
//     @CalledByNative
//     private static String getDisplayNameForLocale(Locale locale, Locale displayLocale) {
//         return locale.getDisplayName(displayLocale);
//     }
// 
//     /**
//      * @return true if the system default layout direction is RTL, false otherwise.
//      *         RTL layout support is from Jelly Bean MR1, so if the version is lower
//      *         than that, it is always false.
//      */
//     public static boolean isSystemLayoutDirectionRtl() {
//         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
//             return TextUtils.getLayoutDirectionFromLocale(Locale.getDefault())
//                     == View.LAYOUT_DIRECTION_RTL;
//         }
//         return false;
//     }
// 
//     /**
//      * Jni binding to base::i18n::IsRTL.
//      * @return true if the current locale is right to left.
//      */
//     public static boolean isRtl() {
//         return nativeIsRTL();
//     }
// 
//     /**
//      * Jni binding to base::i18n::GetFirstStrongCharacterDirection
//      * @param string String to decide the direction.
//      * @return One of the UNKNOWN_DIRECTION, RIGHT_TO_LEFT, and LEFT_TO_RIGHT.
//      */
//     public static int getFirstStrongCharacterDirection(String string) {
//         return nativeGetFirstStrongCharacterDirection(string);
//     }
// 
//     private static native boolean nativeIsRTL();
// 
//     private static native int nativeGetFirstStrongCharacterDirection(String string);
// }


// Path: content/src/org/chromium/content/browser/ResourceExtractor.java
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.AssetManager;
import android.os.AsyncTask;
import android.preference.PreferenceManager;
import android.util.Log;
import org.chromium.base.PathUtils;
import org.chromium.ui.LocalizationUtils;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.HashSet;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.regex.Pattern;

            deleteFiles(mContext);
        }
        catch (InterruptedException e3) {
            deleteFiles(mContext);
        }
    }

    // This will extract the application pak resources in an
    // AsyncTask. Call waitForCompletion() at the point resources
    // are needed to block until the task completes.
    public void startExtractingResources() {
        if (mExtractTask != null) {
            return;
        }

        if (shouldSkipPakExtraction()) {
            return;
        }

        mExtractTask = new ExtractTask();
        mExtractTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    }

    public static File getOutputDirFromContext(Context context) {
        return new File(PathUtils.getDataDirectory(context.getApplicationContext()), "paks");
    }

    public static void deleteFiles(Context context) {
        File dir = getOutputDirFromContext(context);
        if (dir.exists()) {
            File[] files = dir.listFiles();