导航菜单

页面标题

页面副标题

Adobe Acrobat v15.3 - g.java 源代码

正在查看: Adobe Acrobat v15.3 应用的 g.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.adobe.libs.services.a;

import android.content.SharedPreferences;
import android.util.Pair;
import com.adobe.libs.buildingblocks.utils.BBFileUtils;
import com.adobe.reader.filebrowser.ARFileEntry;
import java.io.File;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;

public final class g {

    private static g f133a = null;
    private HashSet<i> b = new HashSet<>();

    private g() {
    }

    private static long a(int i) {
        File file;
        long length;
        int i2;
        long j = 0;
        com.adobe.libs.services.c.a.a();
        SharedPreferences sharedPreferences = com.adobe.libs.services.c.a.b().getSharedPreferences("com.adobe.libs.services.blueheron.SVBlueHeronCacheManager.cloudcache", 0);
        String string = sharedPreferences.getString(a(h.FILE_PATH, i), null);
        if (string == null) {
            return 0L;
        }
        try {
            file = new File(string);
            length = file.length();
        } catch (SecurityException e) {
        }
        try {
            if (file.delete() || !file.exists()) {
                SharedPreferences.Editor edit = sharedPreferences.edit();
                a(edit, i);
                int i3 = i + 1;
                while (true) {
                    i2 = i3;
                    String string2 = sharedPreferences.getString(a(h.ASSET_ID, i2), null);
                    if (string2 == null) {
                        break;
                    }
                    a(edit, i2 - 1, sharedPreferences.getString(a(h.FILE_PATH, i2), null), string2, sharedPreferences.getLong(a(h.MODIFIED_DATE_AT_DOWNLOAD, i2), 0L), sharedPreferences.getLong(a(h.UPDATED_MODIFIED_DATE, i2), 0L), Integer.valueOf(sharedPreferences.getInt(a(h.LAST_VIEWED_PAGE_NUM, i2), -1)), sharedPreferences.getString(a(h.BOOKMARKS_LIST, i2), ARFileEntry.DEFAULT_ENTRY_ICON_STRING));
                    i3 = i2 + 1;
                }
                if (i2 > 0) {
                    a(edit, i2 - 1);
                }
                edit.apply();
                String str = "Cache manager : deleted file : " + string;
                com.adobe.libs.services.h.n.g();
            }
            return length;
        } catch (SecurityException e2) {
            j = length;
            String str2 = "Could not delete cached file " + string;
            com.adobe.libs.services.h.n.g();
            return j;
        }
    }

    public static long a(String str) {
        String str2 = "Cache Manager : deleting file with ID : " + str;
        com.adobe.libs.services.h.n.g();
        return a(k(str));
    }

    public static final synchronized g a() {
        g gVar;
        synchronized (g.class) {
            if (f133a == null) {
                f133a = new g();
            }
            gVar = f133a;
        }
        return gVar;
    }

    private static String a(h hVar, int i) {
        return hVar.toString() + i;
    }

    private static void a(SharedPreferences.Editor editor, int i) {
        for (h hVar : h.values()) {
            editor.remove(a(hVar, i));
        }
    }

    private static void a(SharedPreferences.Editor editor, int i, String str, String str2, long j, long j2, Integer num, String str3) {
        editor.putString(a(h.FILE_PATH, i), str);
        editor.putString(a(h.ASSET_ID, i), str2);
        editor.putLong(a(h.MODIFIED_DATE_AT_DOWNLOAD, i), j);
        editor.putLong(a(h.UPDATED_MODIFIED_DATE, i), j2);
        if (num != null) {
            editor.putInt(a(h.LAST_VIEWED_PAGE_NUM, i), num.intValue());
        }
        editor.putString(a(h.BOOKMARKS_LIST, i), str3);
    }

    public static void a(String str, int i) {
        int k = k(str);
        if (k != -1) {
            com.adobe.libs.services.c.a.a();
            SharedPreferences.Editor edit = com.adobe.libs.services.c.a.b().getSharedPreferences("com.adobe.libs.services.blueheron.SVBlueHeronCacheManager.cloudcache", 0).edit();
            edit.putInt(a(h.LAST_VIEWED_PAGE_NUM, k), i);
            edit.apply();
        }
    }

    public static void a(String str, long j) {
        int k = k(str);
        if (k != -1) {
            com.adobe.libs.services.c.a.a();
            SharedPreferences.Editor edit = com.adobe.libs.services.c.a.b().getSharedPreferences("com.adobe.libs.services.blueheron.SVBlueHeronCacheManager.cloudcache", 0).edit();
            edit.putLong(a(h.UPDATED_MODIFIED_DATE, k), j);
            edit.apply();
        }
    }

    public static void a(String str, String str2) {
        int k = k(str);
        if (k != -1) {
            com.adobe.libs.services.c.a.a();
            SharedPreferences.Editor edit = com.adobe.libs.services.c.a.b().getSharedPreferences("com.adobe.libs.services.blueheron.SVBlueHeronCacheManager.cloudcache", 0).edit();
            edit.putString(a(h.BOOKMARKS_LIST, k), str2);
            edit.apply();
        }
    }

    public static void a(String str, boolean z, String str2, String str3) {
        String str4 = "Cache Manager : renaming asset with ID : " + str;
        com.adobe.libs.services.h.n.g();
        if (z) {
            c(str2, str3);
            return;
        }
        int k = k(str);
        if (k != -1) {
            com.adobe.libs.services.c.a.a();
            SharedPreferences.Editor edit = com.adobe.libs.services.c.a.b().getSharedPreferences("com.adobe.libs.services.blueheron.SVBlueHeronCacheManager.cloudcache", 0).edit();
            edit.putString(a(h.FILE_PATH, k), str3);
            edit.apply();
        }
    }

    public static void b() {
        com.adobe.libs.services.c.a.a();
        SharedPreferences.Editor edit = com.adobe.libs.services.c.a.b().getSharedPreferences("com.adobe.libs.services.blueheron.SVBlueHeronCacheManager.cloudcache", 0).edit();
        edit.clear();
        edit.apply();
        BBFileUtils.a(com.adobe.libs.services.h.n.d(), false);
    }

    public static void b(String str) {
        String str2 = "Cache Manager : deleting document with path : " + str;
        com.adobe.libs.services.h.n.g();
        if (str != null) {
            BBFileUtils.b(new File(str));
            h();
        }
    }

    public static void b(String str, String str2) {
        int k = k(str);
        if (str2 == null || k == -1) {
            return;
        }
        com.adobe.libs.services.c.a.a();
        SharedPreferences.Editor edit = com.adobe.libs.services.c.a.b().getSharedPreferences("com.adobe.libs.services.blueheron.SVBlueHeronCacheManager.cloudcache", 0).edit();
        edit.putBoolean(a(h.IS_ROOTED, k), str2.equalsIgnoreCase(com.adobe.libs.services.auth.d.getInstance().getAutoUploadFolderID()) ? false : true);
        edit.apply();
    }

    public static long c() {
        int i = 0;
        com.adobe.libs.services.c.a.a();
        SharedPreferences sharedPreferences = com.adobe.libs.services.c.a.b().getSharedPreferences("com.adobe.libs.services.blueheron.SVBlueHeronCacheManager.cloudcache", 0);
        long j = 0;
        while (true) {
            String string = sharedPreferences.getString(a(h.FILE_PATH, i), null);
            if (string == null) {
                String str = "current cache size: " + j;
                return j;
            }
            j += new File(string).length();
            i++;
        }
    }

    public static void c(String str) {
        String str2 = "Cache Manager : deleting folder with path : " + str;
        com.adobe.libs.services.h.n.g();
        BBFileUtils.b(new File(str));
        h();
    }

    private static void c(String str, String str2) {
        com.adobe.libs.services.c.a.a();
        SharedPreferences sharedPreferences = com.adobe.libs.services.c.a.b().getSharedPreferences("com.adobe.libs.services.blueheron.SVBlueHeronCacheManager.cloudcache", 0);
        SharedPreferences.Editor edit = sharedPreferences.edit();
        for (int i = 0; sharedPreferences.getString(a(h.ASSET_ID, i), null) != null; i++) {
            String string = sharedPreferences.getString(a(h.FILE_PATH, i), null);
            if (string != null && BBFileUtils.c(new File(string), new File(str))) {
                edit.putString(a(h.FILE_PATH, i), str2 + File.separator + string.substring(str.length() + 1, string.length()));
            }
        }
        edit.apply();
    }

    public static long d(String str) {
        int k = k(str);
        com.adobe.libs.services.c.a.a();
        return com.adobe.libs.services.c.a.b().getSharedPreferences("com.adobe.libs.services.blueheron.SVBlueHeronCacheManager.cloudcache", 0).getLong(a(h.MODIFIED_DATE_AT_DOWNLOAD, k), -1L);
    }

    public static ArrayList<String> d() {
        int i = 0;
        com.adobe.libs.services.c.a.a();
        SharedPreferences sharedPreferences = com.adobe.libs.services.c.a.b().getSharedPreferences("com.adobe.libs.services.blueheron.SVBlueHeronCacheManager.cloudcache", 0);
        ArrayList<String> arrayList = new ArrayList<>();
        while (true) {
            String string = sharedPreferences.getString(a(h.ASSET_ID, i), null);
            if (string == null) {
                return arrayList;
            }
            arrayList.add(string);
            i++;
        }
    }

    public static String e(String str) {
        int k = k(str);
        com.adobe.libs.services.c.a.a();
        return com.adobe.libs.services.c.a.b().getSharedPreferences("com.adobe.libs.services.blueheron.SVBlueHeronCacheManager.cloudcache", 0).getString(a(h.BOOKMARKS_LIST, k), ARFileEntry.DEFAULT_ENTRY_ICON_STRING);
    }

    public static ArrayList<Pair<String, String>> e() {
        int i = 0;
        com.adobe.libs.services.c.a.a();
        SharedPreferences sharedPreferences = com.adobe.libs.services.c.a.b().getSharedPreferences("com.adobe.libs.services.blueheron.SVBlueHeronCacheManager.cloudcache", 0);
        ArrayList<Pair<String, String>> arrayList = new ArrayList<>();
        while (true) {
            String string = sharedPreferences.getString(a(h.ASSET_ID, i), null);
            if (string == null) {
                return arrayList;
            }
            arrayList.add(new Pair<>(string, f(string)));
            i++;
        }
    }

    public static String f(String str) {
        int k = k(str);
        com.adobe.libs.services.c.a.a();
        return com.adobe.libs.services.c.a.b().getSharedPreferences("com.adobe.libs.services.blueheron.SVBlueHeronCacheManager.cloudcache", 0).getString(a(h.FILE_PATH, k), ARFileEntry.DEFAULT_ENTRY_ICON_STRING);
    }

    public static void f() {
    }

    private static int g() {
        com.adobe.libs.services.c.a.a();
        int i = -1;
        do {
            i++;
        } while (com.adobe.libs.services.c.a.b().getSharedPreferences("com.adobe.libs.services.blueheron.SVBlueHeronCacheManager.cloudcache", 0).getAll().containsKey(a(h.ASSET_ID, i)));
        return i - 1;
    }

    public static int g(String str) {
        int k = k(str);
        com.adobe.libs.services.c.a.a();
        return com.adobe.libs.services.c.a.b().getSharedPreferences("com.adobe.libs.services.blueheron.SVBlueHeronCacheManager.cloudcache", 0).getInt(a(h.LAST_VIEWED_PAGE_NUM, k), -1);
    }

    private static void h() {
        int i = 0;
        com.adobe.libs.services.c.a.a();
        SharedPreferences sharedPreferences = com.adobe.libs.services.c.a.b().getSharedPreferences("com.adobe.libs.services.blueheron.SVBlueHeronCacheManager.cloudcache", 0);
        Map<String, ?> all = sharedPreferences.getAll();
        SharedPreferences.Editor edit = sharedPreferences.edit();
        edit.clear();
        int i2 = 0;
        while (true) {
            String a2 = a(h.FILE_PATH, i2);
            if (!all.containsKey(a2)) {
                edit.apply();
                return;
            }
            String str = (String) all.get(a2);
            if (new File(str).exists()) {
                a(edit, i, str, (String) all.get(a(h.ASSET_ID, i2)), ((Long) all.get(a(h.MODIFIED_DATE_AT_DOWNLOAD, i2))).longValue(), ((Long) all.get(a(h.UPDATED_MODIFIED_DATE, i2))).longValue(), (Integer) all.get(a(h.LAST_VIEWED_PAGE_NUM, i2)), (String) all.get(a(h.BOOKMARKS_LIST, i2)));
                i++;
            }
            i2++;
        }
    }

    public static boolean h(String str) {
        int k = k(str);
        com.adobe.libs.services.c.a.a();
        return com.adobe.libs.services.c.a.b().getSharedPreferences("com.adobe.libs.services.blueheron.SVBlueHeronCacheManager.cloudcache", 0).getBoolean(a(h.IS_ROOTED, k), true);
    }

    private boolean j(String str) {
        boolean z = true;
        Iterator<i> it = this.b.iterator();
        while (it.hasNext() && (z = it.next().isPurgeable(str))) {
        }
        return z;
    }

    private static int k(String str) {
        int i = 0;
        com.adobe.libs.services.c.a.a();
        SharedPreferences sharedPreferences = com.adobe.libs.services.c.a.b().getSharedPreferences("com.adobe.libs.services.blueheron.SVBlueHeronCacheManager.cloudcache", 0);
        while (true) {
            String string = sharedPreferences.getString(a(h.ASSET_ID, i), null);
            if (string == null) {
                return -1;
            }
            if (string.equals(str)) {
                return i;
            }
            i++;
        }
    }

    public final void a(i iVar) {
        this.b.add(iVar);
    }

    public final void a(String str, String str2, long j) {
        int i;
        String str3 = "Cache Manager : updating file with info : " + str2 + " " + str;
        com.adobe.libs.services.h.n.g();
        if (com.adobe.libs.services.h.n.h(str)) {
            String e = e(str2);
            com.adobe.libs.services.c.a.a();
            SharedPreferences sharedPreferences = com.adobe.libs.services.c.a.b().getSharedPreferences("com.adobe.libs.services.blueheron.SVBlueHeronCacheManager.cloudcache", 0);
            Map<String, ?> all = sharedPreferences.getAll();
            SharedPreferences.Editor edit = sharedPreferences.edit();
            edit.clear();
            a(edit, 0, str, str2, j, j, null, e);
            int i2 = 0;
            for (int i3 = 0; all.containsKey(a(h.ASSET_ID, i3)); i3++) {
                String str4 = (String) all.get(a(h.FILE_PATH, i3));
                String str5 = (String) all.get(a(h.ASSET_ID, i3));
                long longValue = ((Long) all.get(a(h.MODIFIED_DATE_AT_DOWNLOAD, i3))).longValue();
                long longValue2 = ((Long) all.get(a(h.UPDATED_MODIFIED_DATE, i3))).longValue();
                Integer num = (Integer) all.get(a(h.LAST_VIEWED_PAGE_NUM, i3));
                String str6 = (String) all.get(a(h.BOOKMARKS_LIST, i3));
                if (str5.equals(str2)) {
                    i = i2;
                } else {
                    i = i2 + 1;
                    a(edit, i, str4, str5, longValue, longValue2, num, str6);
                }
                i2 = i;
            }
            edit.apply();
            long c = c();
            while (com.adobe.libs.services.b.a.b() - c < 0 && i2 > 0) {
                if (j(sharedPreferences.getString(a(h.ASSET_ID, i2), null))) {
                    long a2 = a(i2);
                    c -= a2;
                    String str7 = "Purged cache, current cache size: " + c + " fileSize that got purged: " + a2;
                }
                i2--;
            }
        }
    }

    public final boolean a(long j) {
        boolean z;
        int g = g();
        long c = c();
        com.adobe.libs.services.c.a.a();
        SharedPreferences sharedPreferences = com.adobe.libs.services.c.a.b().getSharedPreferences("com.adobe.libs.services.blueheron.SVBlueHeronCacheManager.cloudcache", 0);
        while (true) {
            if (com.adobe.libs.services.h.n.f() - 52428800 >= j && c + j <= com.adobe.libs.services.b.a.b()) {
                z = true;
                break;
            }
            if (g < 0) {
                z = false;
                break;
            }
            if (j(sharedPreferences.getString(a(h.ASSET_ID, g), null))) {
                long a2 = a(g);
                c -= a2;
                String str = "Purged cache, current cache size: " + c + " fileSize that got purged: " + a2;
            }
            g--;
        }
        if (g() >= 0 || com.adobe.libs.services.h.n.f() - 52428800 <= j) {
            return z;
        }
        return true;
    }

    public final void b(i iVar) {
        this.b.remove(iVar);
    }

    public final boolean i(String str) {
        int k = k(str);
        if (k == -1) {
            return false;
        }
        com.adobe.libs.services.c.a.a();
        SharedPreferences sharedPreferences = com.adobe.libs.services.c.a.b().getSharedPreferences("com.adobe.libs.services.blueheron.SVBlueHeronCacheManager.cloudcache", 0);
        if (sharedPreferences.getLong(a(h.MODIFIED_DATE_AT_DOWNLOAD, k), 0L) == sharedPreferences.getLong(a(h.UPDATED_MODIFIED_DATE, k), 0L)) {
            return false;
        }
        Iterator<i> it = this.b.iterator();
        boolean z = false;
        while (it.hasNext() && !(z = it.next().isInTransitionalState(str))) {
        }
        return !z;
    }
}