/**
 * $URL$
 * DAAND
 * Copyright (C) 2004 - 2013, INSIDE Secure BV.  All rights reserved.
 */
package com.insidesecure.drm.android.reference;

import android.app.Application;
import android.content.Intent;
import android.os.StrictMode;
import com.insidesecure.drm.android.reference.activities.AddURLActivity;
import com.insidesecure.drm.android.reference.activities.HomeActivity;
import com.insidesecure.drm.android.reference.services.DownloadService;

public abstract class DRMFusionAgentReferenceApplication extends Application
{
    private String TAG = "DRMFusionAgentReferenceApplication";

    public static Class sSettingsClass;
    public static Class sPlayMediaActivityClass;
    public static Class sAddURLActivityClass = AddURLActivity.class;
    public static Class sHomeActivityClass = HomeActivity.class;
    public static String sMiscVersionInfo = "";

    public static boolean sUsesNativePlayer = false;
    public static boolean sSupportOldAndroidVersions = false;
    public static boolean sSupportBackgroundDownloadAndPlay = false;
    public static boolean sEnableStrictMode = false;
    public static boolean sSupportsAudioOnlySmoothStreaming = true;

    public DRMAgentDelegate.CertificateProvider sCertificateProvider;

    @Override
    public void onCreate()
    {
        // Setup the DRM agent delegate with the provider of our certificates
        DRMAgentDelegate.sCertificateProvider = sCertificateProvider;

        Intent intent = new Intent(getBaseContext(), DownloadService.class);
        startService(intent);

        if (sEnableStrictMode)
        {
            StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                    .detectNetwork()
                    .penaltyLog()
                    .penaltyDialog()
                    .penaltyDeath()
                    .build());
            StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
                    .detectLeakedClosableObjects()
                    .detectLeakedRegistrationObjects()
                    .penaltyLog()
                    .build());
        }

        super.onCreate();
    }

}
