/*
 * Copyright (C) 2013 nohana, Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.amalgam.app;

import android.app.Application;
import android.content.pm.ApplicationInfo;

/**
 * Utility for application object.
 */
public final class ApplicationUtils {
    private ApplicationUtils() {}

    /**
     * Checks if the application is running as debug mode or not.
     * @param app the application to check
     * @return true if debuggable, false otherwise.
     */
    public static final boolean isDebuggable(Application app) {
        ApplicationInfo info = app.getApplicationInfo();
        return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
    }
}
@@ -698,509 +698,1610 @@
 ent.
-pm.ApplicationInfo;%0A%0A/**%0A * Utility for application object.%0A */%0Apublic final class ApplicationUtils %7B%0A    private ApplicationUtils() %7B%7D%0A%0A    /**%0A     * Checks if the application is running as debug mode or not.%0A     * @param app the application to check%0A     * @return true if debuggable, false otherwise.%0A     */%0A    public static final boolean isDebuggable(Application app) %7B%0A        ApplicationInfo info = app.getApplicationInfo();%0A        return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0
+Context;%0Aimport android.content.pm.ApplicationInfo;%0Aimport android.content.pm.PackageInfo;%0Aimport android.content.pm.PackageManager;%0A%0A/**%0A * Utility for application object.%0A */%0Apublic final class ApplicationUtils %7B%0A    private static final String%5B%5D INTERNAL_PATH = new String%5B%5D %7B %22/data%22, %22/system%22 %7D;%0A%0A    private ApplicationUtils() %7B%7D%0A%0A    public static final boolean isDebuggable(Context context) %7B%0A        return isDebuggable((Application) context.getApplicationContext());%0A    %7D%0A    /**%0A     * Checks if the application is running as debug mode or not.%0A     * @param app the application to check%0A     * @return true if debuggable, false otherwise.%0A     */%0A    public static final boolean isDebuggable(Application app) %7B%0A        ApplicationInfo info = app.getApplicationInfo();%0A        return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;%0A    %7D%0A%0A    public static boolean isInstalledOnSDCard(Context context) %7B%0A        return isInstalledOnSDCard((Application) context.getApplicationContext());%0A    %7D%0A%0A    public static final boolean isInstalledOnSDCard(Application app) %7B%0A        try %7B%0A            String packageName = app.getPackageName();%0A            PackageInfo info = app.getPackageManager().getPackageInfo(packageName, 0);%0A            String dir = info.applicationInfo.sourceDir;%0A%0A            for (String path : INTERNAL_PATH) %7B%0A                if (path.equals(dir.substring(0, path.length())))%0A                    return false;%0A            %7D%0A        %7D catch (PackageManager.NameNotFoundException exp) %7B%0A            throw new IllegalArgumentException(exp);%0A        %7D%0A        return true
 ;%0A  

Add application installation location checker