Skip to content

Instantly share code, notes, and snippets.

@WanghongLin
WanghongLin / GLOneActivity.kt
Created March 17, 2020 12:10
GL10 for Android
import android.graphics.Bitmap
import android.graphics.Canvas
import android.opengl.GLES10
import android.opengl.GLSurfaceView
import android.os.Bundle
import android.support.design.widget.Snackbar
import android.support.v7.app.AppCompatActivity
import kotlinx.android.synthetic.main.activity_glone.*
import kotlinx.android.synthetic.main.content_glone.*
import java.nio.ByteBuffer
@WanghongLin
WanghongLin / SplitApkInstaller.java
Created December 31, 2017 11:46
Install split apk
private static void installMultiple(Context context) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
PackageInstaller packageInstaller = context.getPackageManager().getPackageInstaller();
PackageInstaller.SessionParams sessionParams = new PackageInstaller.SessionParams(PackageInstaller.SessionParams.MODE_FULL_INSTALL);
try {
final int sessionId = packageInstaller.createSession(sessionParams);
Log.d(TAG, "installMultiple: sessionId " + sessionId);
@WanghongLin
WanghongLin / ColorSpace.java
Created October 8, 2016 10:47
Conversion between RGB and HSV
import java.awt.Color;
import java.util.Arrays;
/**
* Created by wanghong on 10/8/16.
*/
public class ColorSpace {
public static void main(String[] args) {
@WanghongLin
WanghongLin / exec_out.sh
Created April 12, 2016 06:17
A simple script exec-out wrapper to extract directory for android app's debug version
#!/bin/bash
P=
F=
D=
function usage()
{
echo "$(basename $0) [-f file] [-d directory] -p package"
exit 1
}
@WanghongLin
WanghongLin / Apache_license_v2.xml
Created July 4, 2015 02:51
Apache license v2 for android studio copyright template
<component name="CopyrightManager">
<copyright>
<option name="myName" value="Apache License v2" />
<option name="notice" value="Copyright (C) &amp;#36;today.year &amp;#36;username&#10;Licensed under the Apache License, Version 2.0 (the &#34;License&#34;);&#10;you may not use this file except in compliance with the License.&#10;You may obtain a copy of the License at&#10;&#10; http://www.apache.org/licenses/LICENSE-2.0&#10;&#10;Unless required by applicable law or agreed to in writing, software&#10;distributed under the License is distributed on an &#34;AS IS&#34; BASIS,&#10;WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&#10;See the License for the specific language governing permissions and&#10;limitations under the License." />
</copyright>
</component>
@WanghongLin
WanghongLin / supernova-include-paths.xml
Last active November 28, 2016 08:56
Eclipse CDT settings for supernova
<?xml version="1.0" encoding="UTF-8"?>
<cdtprojectproperties>
<section name="org.eclipse.cdt.internal.ui.wizards.settingswizards.IncludePaths">
<language name="holder for library settings">
</language>
<language name="Assembly">
<includepath>/opt/x-tools/mips-4.3/mips-linux-gnu/include/c++/4.3.2/mips-linux-gnu</includepath>
<includepath>/opt/x-tools/mips-4.3/mips-linux-gnu/include/c++/4.3.2</includepath>
<includepath>/opt/x-tools/mips-4.3/mips-linux-gnu/libc/usr/include</includepath>
@WanghongLin
WanghongLin / import_keypair.sh
Created June 10, 2015 06:28
import key pair
#!/bin/bash
storepass=
keypass=
key_alias=platform
openssl pkcs8 -inform DER -nocrypt -in platform.pk8 | \
openssl pkcs12 -export -in platform.x509.pem -inkey /dev/stdin \
-name $key_alias -password pass:$keypass -out tmp.p12
@WanghongLin
WanghongLin / kitkat-include-paths-and-symbols.xml
Created June 10, 2015 06:24
aosp kitkat include paths and symbols for Eclipse IDE
<?xml version="1.0" encoding="UTF-8"?>
<cdtprojectproperties>
<section name="org.eclipse.cdt.internal.ui.wizards.settingswizards.IncludePaths">
<language name="holder for library settings">
</language>
<language name="Assembly">
<includepath>${ProjDirPath}/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.7/lib/gcc/arm-eabi/4.7/include</includepath>
<includepath>${ProjDirPath}/build/core/combo/include/arch/linux-arm</includepath>
<includepath>${ProjDirPath}/system/core/include</includepath>
@WanghongLin
WanghongLin / ubifs.sh
Created June 10, 2015 06:20
unpackage and package HIT archive data
#!/bin/bash
[ $# -ne 1 ] && { echo not system.img provided, exit.; exit 0; }
sudo umount `pwd`/system
sudo rmmod ubifs
sudo rmmod ubi
sudo rmmod nandsim
sudo rmmod mtdblock
@WanghongLin
WanghongLin / Makefile.diff
Created May 29, 2015 11:18
android build inherited product copy file override parent product copy file
Index: build/core/Makefile
===================================================================
--- build/core/Makefile (revision 214)
+++ build/core/Makefile (working copy)
@@ -19,6 +19,11 @@
# The filter part means "only eval the copy-one-file rule if this
# src:dest pair is the first one to match the same dest"
#$(1): the src:dest pair
+
+# make the product copy files in inherit override the parent