https://www.gravatar.com/avatar/7a0c24f697ea1587001c36d00039b60f?s=240&d=mp

android实现单个任务依次执行

之前有一篇文章介绍了用thread的join()方法来实现,但是我在实际应用过程中发现了一个问题,就是当任务占用时间过长时,会导致service的超时,太杯具了,研究了下,发现也许有更好的方法,还没来得及测试,先记录。

AntiLVL – Android License Verification Library Subversion

[ What is it? ]
AntiLVL's purpose is to subvert standard license protection methods such as the Android License Verification Library (LVL), Amazon Appstore DRM and Verizon DRM. It also disables many anti-cracking and anti-tampering protection methods. Because every implementation of the LVL is potentially (and often is) quite different, it's not possible to automate patching in every case. It will not always work. However, it has been designed to get around obfuscation and to apply many variations.
Under the hood, AntiLVL is a configurable Smali code patcher with rules defined in user-modifiable XML files stored inside the jar called fingerprints. Brief summary of how it works:
* Decompiles the Apk
* Perform  regular expression matching
* Carrie out defined modifications
* Recompile, update classes.dex
* Resign and zipalign

[这是神马?] 英文不好,意思大概就是这个东西可以用来绕过android的签名验证,可以给smail代码打补丁,重新修改xml文件里面的规则等等。

Google 决定永久收藏弹吉他 doodle

纪念莱斯·保罗电吉他之父诞辰 96 周年的可以直接弹奏的 doodle昨天已经多放了一天了,但是大家还是玩得不亦乐乎,总不能再多放一天吧?于是Google决定把这个doodle单独放到一个永久的网页里,大家可以随时玩个够了。

Java建立Zip压缩文件

本文是关于实现Java建立Zip压缩文件的代码实例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import java.io.*;
import java.util.zip.*;

class Zip {
    public static void main(String[] args) throws IOException {
        byte[] b = new byte[512];
        ZipOutputStream zout = new ZipOutputStream(System.out);

        for (int i = 0; i < args.length; i++) {
            InputStream in = new FileInputStream(args[i]);
            ZipEntry e = new ZipEntry(args[i].replace(File.separatorChar, '/'));
            zout.putNextEntry(e);
            int len = 0;
            while ((len = in.read(b)) != -1) {
                zout.write(b, 0, len);
            }
            zout.closeEntry();
            print(e);
        }
        zout.close();
    }

    public static void print(ZipEntry e) {
        PrintStream err = System.err;
        err.print("added " + e.getName());
        if (e.getMethod() == ZipEntry.DEFLATED) {
            long size = e.getSize();
            if (size > 0) {
                long csize = e.getCompressedSize();
                long ratio = ((size - csize) * 100) / size;
                err.println(" (deflated " + ratio + "%)");
            } else {
                err.println(" (deflated 0%)");
            }
        } else {
            err.println(" (stored 0%)");
        }
    }
}

JNI的基本类型

Java Language Type Native Type De**s**cription
boolean jboolean unsigned 8 bits
byte jbyte signed 8 bits
char jchar unsigned 16 bits
short jshort signed 16 bits
int jint signed 32 bits
long jlong signed 64 bits
float jfloat 32 bits
double jdouble 64 bits
字符 Java类型 C类型
V void void
Z jboolean boolean
I jint int
J jlong long
D jdouble double
F jfloat float
B jbyte byte
C jchar char
S jshort short
[I jintArray int[]
[F jfloatArray float[]
[B jbyteArray byte[]
[C jcharArray char[]
[S jshortArray short[]
[D jdoubleArray double[]
[J jlongArray long[]
[Z jbooleanArray boolean[]
JNINativeMethod方法的结构如下:
typedef struct {
const char* name;
const char* signature;
void* fnPtr;
} JNINativeMethod
第一个变量name是Java中函数的名字。 第二个变量signature,用字符串是描述了函数的参数和返回值 第三个变量fnPtr是函数指针,指向C函数。

第二个方法的涵义是: