// Path: phial-overlay/src/main/java/com/mindcoders/phial/internal/keyvalue/BuildInfoWriter.java
// public final class BuildInfoWriter extends InfoWriter {
//     private final static String DATE_FORMAT = "d MMM yyyy HH:mm Z";
//     @Nullable
//     private final Long buildTime;
//     @Nullable
//     private final String buildCommit;
// 
//     public BuildInfoWriter(Context context) {
//         this(context, null, null);
//     }
// 
//     public BuildInfoWriter(Context context, @Nullable Long buildTime, @Nullable String buildCommit) {
//         super(context, "Build");
//         this.buildTime = buildTime;
//         this.buildCommit = buildCommit;
//     }
// 
//     @Override
//     protected void writeInfo(Category category) {
//         final String packageName = getContext().getPackageName();
//         category.setKey("Package", packageName);
// 
//         try {
//             final PackageInfo packageInfo = getContext().getPackageManager()
//                     .getPackageInfo(packageName, PackageManager.GET_META_DATA);
//             category.setKey("Version", packageInfo.versionName);
//         } catch (PackageManager.NameNotFoundException e) {
//             PhialErrorPlugins.onError(e);
//         }
// 
//         if (buildTime != null) {
//             category.setKey("BuildTime", getBuildTime(buildTime));
//         }
// 
//         if (buildCommit != null) {
//             category.setKey("BuildCommit", buildCommit);
//         }
//     }
// 
// 
//     private static String getBuildTime(long buildTime) {
//         final Date buildDate = new Date(buildTime);
//         return new SimpleDateFormat(DATE_FORMAT, Locale.US).format(buildDate);
//     }
// }
// 
// Path: phial-overlay/src/main/java/com/mindcoders/phial/internal/keyvalue/InfoWriter.java
// public abstract class InfoWriter {
//     private final Category category;
//     private final Context context;
// 
//     public InfoWriter(Context context, String categoryName) {
//         this.category = Phial.category(categoryName);
//         this.context = context;
//     }
// 
//     public final void writeInfo() {
//         writeInfo(category);
//     }
// 
//     protected abstract void writeInfo(Category category);
// 
//     protected final Context getContext() {
//         return context;
//     }
// }
// 
// Path: phial-overlay/src/main/java/com/mindcoders/phial/internal/keyvalue/SystemInfoWriter.java
// public final class SystemInfoWriter extends InfoWriter {
//     public SystemInfoWriter(Context context) {
//         super(context, "System");
//     }
// 
//     @Override
//     protected void writeInfo(Category saver) {
//         saver.setKey("Board", Build.BOARD);
//         saver.setKey("Brand", Build.BRAND);
//         saver.setKey("Device", Build.DEVICE);
//         saver.setKey("Model", Build.MODEL);
//         saver.setKey("Manufacturer", MANUFACTURER);
//         saver.setKey("Product", Build.PRODUCT);
//         saver.setKey("SDK", Build.VERSION.SDK_INT);
//         saver.setKey("OS Version", System.getProperty("os.version") + " (" + Build.VERSION.INCREMENTAL + ")");
//         saver.setKey("SDCard state", Environment.getExternalStorageState());
// 
//         final DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics();
//         saver.setKey("Density", displayMetrics.density);
//         saver.setKey("Width", displayMetrics.widthPixels);
//         saver.setKey("Height", displayMetrics.heightPixels);
//     }
// }
// 
// Path: phial-overlay/src/main/java/com/mindcoders/phial/internal/share/attachment/AttacherAdaptor.java
// public class AttacherAdaptor implements ListAttacher {
//     private final Attacher attacher;
// 
//     public AttacherAdaptor(Attacher attacher) {
//         this.attacher = attacher;
//     }
// 
//     public static ListAttacher adapt(Attacher attacher) {
//         return new AttacherAdaptor(attacher);
//     }
// 
//     @Override
//     public List<File> provideAttachment() throws Exception {
//         final File file = attacher.provideAttachment();
//         if (file != null) {
//             return Collections.singletonList(file);
//         } else {
//             return Collections.emptyList();
//         }
//     }
// 
//     @Override
//     public void onPreDebugWindowCreated() {
//         attacher.onPreDebugWindowCreated();
//     }
// 
//     @Override
//     public void onAttachmentNotNeeded() {
//         attacher.onAttachmentNotNeeded();
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
// 
//         AttacherAdaptor that = (AttacherAdaptor) o;
// 
//         return attacher.equals(that.attacher);
// 
//     }
// 
//     @Override
//     public int hashCode() {
//         return attacher.hashCode();
//     }
// }


import android.app.Application;
import com.mindcoders.phial.internal.keyvalue.BuildInfoWriter;
import com.mindcoders.phial.internal.keyvalue.InfoWriter;
import com.mindcoders.phial.internal.keyvalue.SystemInfoWriter;
import com.mindcoders.phial.internal.share.attachment.AttacherAdaptor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
     *
     * @param attacher that will include extra information to Share data
     * @return same instance of builder
     */
    public PhialBuilder addAttachmentProvider(ListAttacher attacher) {
        this.attachers.add(attacher);
        return this;
    }

    /**
     * Rather include screen shot in share attachment.
     *
     * @param attachScreenshot true to include, false to not include.
     *                         default true
     * @return same instance of builder
     */
    public PhialBuilder attachScreenshot(boolean attachScreenshot) {
        this.attachScreenshots = attachScreenshot;
        return this;
    }

    /**
     * Rather include system info (e.g. Android version, screen size ...) in key-value tab and share attachment.
     *
     * @param applySystemInfo true to include, false to not include.
     *                        default true
     * @return same instance of builder
     */
    public PhialBuilder applySystemInfo(boolean applySystemInfo) {
        if (applySystemInfo) {
// Path: phial-overlay/src/main/java/com/mindcoders/phial/internal/keyvalue/BuildInfoWriter.java
// public final class BuildInfoWriter extends InfoWriter {
//     private final static String DATE_FORMAT = "d MMM yyyy HH:mm Z";
//     @Nullable
//     private final Long buildTime;
//     @Nullable
//     private final String buildCommit;
// 
//     public BuildInfoWriter(Context context) {
//         this(context, null, null);
//     }
// 
//     public BuildInfoWriter(Context context, @Nullable Long buildTime, @Nullable String buildCommit) {
//         super(context, "Build");
//         this.buildTime = buildTime;
//         this.buildCommit = buildCommit;
//     }
// 
//     @Override
//     protected void writeInfo(Category category) {
//         final String packageName = getContext().getPackageName();
//         category.setKey("Package", packageName);
// 
//         try {
//             final PackageInfo packageInfo = getContext().getPackageManager()
//                     .getPackageInfo(packageName, PackageManager.GET_META_DATA);
//             category.setKey("Version", packageInfo.versionName);
//         } catch (PackageManager.NameNotFoundException e) {
//             PhialErrorPlugins.onError(e);
//         }
// 
//         if (buildTime != null) {
//             category.setKey("BuildTime", getBuildTime(buildTime));
//         }
// 
//         if (buildCommit != null) {
//             category.setKey("BuildCommit", buildCommit);
//         }
//     }
// 
// 
//     private static String getBuildTime(long buildTime) {
//         final Date buildDate = new Date(buildTime);
//         return new SimpleDateFormat(DATE_FORMAT, Locale.US).format(buildDate);
//     }
// }
// 
// Path: phial-overlay/src/main/java/com/mindcoders/phial/internal/keyvalue/InfoWriter.java
// public abstract class InfoWriter {
//     private final Category category;
//     private final Context context;
// 
//     public InfoWriter(Context context, String categoryName) {
//         this.category = Phial.category(categoryName);
//         this.context = context;
//     }
// 
//     public final void writeInfo() {
//         writeInfo(category);
//     }
// 
//     protected abstract void writeInfo(Category category);
// 
//     protected final Context getContext() {
//         return context;
//     }
// }
// 
// Path: phial-overlay/src/main/java/com/mindcoders/phial/internal/keyvalue/SystemInfoWriter.java
// public final class SystemInfoWriter extends InfoWriter {
//     public SystemInfoWriter(Context context) {
//         super(context, "System");
//     }
// 
//     @Override
//     protected void writeInfo(Category saver) {
//         saver.setKey("Board", Build.BOARD);
//         saver.setKey("Brand", Build.BRAND);
//         saver.setKey("Device", Build.DEVICE);
//         saver.setKey("Model", Build.MODEL);
//         saver.setKey("Manufacturer", MANUFACTURER);
//         saver.setKey("Product", Build.PRODUCT);
//         saver.setKey("SDK", Build.VERSION.SDK_INT);
//         saver.setKey("OS Version", System.getProperty("os.version") + " (" + Build.VERSION.INCREMENTAL + ")");
//         saver.setKey("SDCard state", Environment.getExternalStorageState());
// 
//         final DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics();
//         saver.setKey("Density", displayMetrics.density);
//         saver.setKey("Width", displayMetrics.widthPixels);
//         saver.setKey("Height", displayMetrics.heightPixels);
//     }
// }
// 
// Path: phial-overlay/src/main/java/com/mindcoders/phial/internal/share/attachment/AttacherAdaptor.java
// public class AttacherAdaptor implements ListAttacher {
//     private final Attacher attacher;
// 
//     public AttacherAdaptor(Attacher attacher) {
//         this.attacher = attacher;
//     }
// 
//     public static ListAttacher adapt(Attacher attacher) {
//         return new AttacherAdaptor(attacher);
//     }
// 
//     @Override
//     public List<File> provideAttachment() throws Exception {
//         final File file = attacher.provideAttachment();
//         if (file != null) {
//             return Collections.singletonList(file);
//         } else {
//             return Collections.emptyList();
//         }
//     }
// 
//     @Override
//     public void onPreDebugWindowCreated() {
//         attacher.onPreDebugWindowCreated();
//     }
// 
//     @Override
//     public void onAttachmentNotNeeded() {
//         attacher.onAttachmentNotNeeded();
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (this == o) return true;
//         if (o == null || getClass() != o.getClass()) return false;
// 
//         AttacherAdaptor that = (AttacherAdaptor) o;
// 
//         return attacher.equals(that.attacher);
// 
//     }
// 
//     @Override
//     public int hashCode() {
//         return attacher.hashCode();
//     }
// }


// Path: phial-overlay/src/main/java/com/mindcoders/phial/PhialBuilder.java
import android.app.Application;
import com.mindcoders.phial.internal.keyvalue.BuildInfoWriter;
import com.mindcoders.phial.internal.keyvalue.InfoWriter;
import com.mindcoders.phial.internal.keyvalue.SystemInfoWriter;
import com.mindcoders.phial.internal.share.attachment.AttacherAdaptor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

     *
     * @param attacher that will include extra information to Share data
     * @return same instance of builder
     */
    public PhialBuilder addAttachmentProvider(ListAttacher attacher) {
        this.attachers.add(attacher);
        return this;
    }

    /**
     * Rather include screen shot in share attachment.
     *
     * @param attachScreenshot true to include, false to not include.
     *                         default true
     * @return same instance of builder
     */
    public PhialBuilder attachScreenshot(boolean attachScreenshot) {
        this.attachScreenshots = attachScreenshot;
        return this;
    }

    /**
     * Rather include system info (e.g. Android version, screen size ...) in key-value tab and share attachment.
     *
     * @param applySystemInfo true to include, false to not include.
     *                        default true
     * @return same instance of builder
     */
    public PhialBuilder applySystemInfo(boolean applySystemInfo) {
        if (applySystemInfo) {
            this.systemInfoWriter = new SystemInfoWriter(application);