// Path: KNOXLSOApp/app/src/main/java/com/akexorcist/knoxlsoapp/manager/FileAssetManager.java
// public class FileAssetManager {
//     public static void copyFileFromAssetToStorage(Context context, String assetFilePath, String filePath) {
//         InputStream in = null;
//         OutputStream out = null;
//         try {
//             in = context.getAssets().open(assetFilePath);
//             File outFile = new File(filePath);
//             out = new FileOutputStream(outFile);
//             copyFile(in, out);
//         } catch (IOException e) {
//             Log.e("tag", "Failed to copy asset file: " + assetFilePath, e);
//         } finally {
//             if (in != null) {
//                 try {
//                     in.close();
//                 } catch (IOException e) {
//                     e.printStackTrace();
//                 }
//             }
//             if (out != null) {
//                 try {
//                     out.close();
//                 } catch (IOException e) {
//                     e.printStackTrace();
//                 }
//             }
//         }
//     }
// 
//     private static void copyFile(InputStream in, OutputStream out) throws IOException {
//         byte[] buffer = new byte[1024];
//         int read;
//         while ((read = in.read(buffer)) != -1) {
//             out.write(buffer, 0, read);
//         }
//     }
// }


import android.app.enterprise.lso.LockscreenOverlay;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import com.akexorcist.knoxlsoapp.manager.FileAssetManager;
package com.akexorcist.knoxlsoapp;



public class DoSomethingActivity extends AppCompatActivity implements View.OnClickListener {
    private String logoFileName = "akexorcist_logo.png";
    private Button btnSetCustomLSO;
    private Button btnClearCustomLSO;

    private LockscreenOverlay lso;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_do_something);

        bindView();
        setupView();
        setupThing();
    }

    private void bindView() {
        btnSetCustomLSO = (Button) findViewById(R.id.btn_set_custom_lso);
        btnClearCustomLSO = (Button) findViewById(R.id.btn_clear_custom_lso);
    }

    private void setupView() {
        btnSetCustomLSO.setOnClickListener(this);
        btnClearCustomLSO.setOnClickListener(this);
    }

    private void setupThing() {
        FileAssetManager.copyFileFromAssetToStorage(this, logoFileName, getFilesDir().getAbsolutePath() + logoFileName);
        lso = LockscreenOverlay.getInstance(this);
    }

// Path: KNOXLSOApp/app/src/main/java/com/akexorcist/knoxlsoapp/manager/FileAssetManager.java
// public class FileAssetManager {
//     public static void copyFileFromAssetToStorage(Context context, String assetFilePath, String filePath) {
//         InputStream in = null;
//         OutputStream out = null;
//         try {
//             in = context.getAssets().open(assetFilePath);
//             File outFile = new File(filePath);
//             out = new FileOutputStream(outFile);
//             copyFile(in, out);
//         } catch (IOException e) {
//             Log.e("tag", "Failed to copy asset file: " + assetFilePath, e);
//         } finally {
//             if (in != null) {
//                 try {
//                     in.close();
//                 } catch (IOException e) {
//                     e.printStackTrace();
//                 }
//             }
//             if (out != null) {
//                 try {
//                     out.close();
//                 } catch (IOException e) {
//                     e.printStackTrace();
//                 }
//             }
//         }
//     }
// 
//     private static void copyFile(InputStream in, OutputStream out) throws IOException {
//         byte[] buffer = new byte[1024];
//         int read;
//         while ((read = in.read(buffer)) != -1) {
//             out.write(buffer, 0, read);
//         }
//     }
// }


// Path: KNOXLSOApp/app/src/main/java/com/akexorcist/knoxlsoapp/DoSomethingActivity.java
import android.app.enterprise.lso.LockscreenOverlay;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import com.akexorcist.knoxlsoapp.manager.FileAssetManager;

package com.akexorcist.knoxlsoapp;



public class DoSomethingActivity extends AppCompatActivity implements View.OnClickListener {
    private String logoFileName = "akexorcist_logo.png";
    private Button btnSetCustomLSO;
    private Button btnClearCustomLSO;

    private LockscreenOverlay lso;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_do_something);

        bindView();
        setupView();
        setupThing();
    }

    private void bindView() {
        btnSetCustomLSO = (Button) findViewById(R.id.btn_set_custom_lso);
        btnClearCustomLSO = (Button) findViewById(R.id.btn_clear_custom_lso);
    }

    private void setupView() {
        btnSetCustomLSO.setOnClickListener(this);
        btnClearCustomLSO.setOnClickListener(this);
    }

    private void setupThing() {
        FileAssetManager.copyFileFromAssetToStorage(this, logoFileName, getFilesDir().getAbsolutePath() + logoFileName);
        lso = LockscreenOverlay.getInstance(this);
    }

    @Override