Skip to content

Instantly share code, notes, and snippets.

View FrannyZhao's full-sized avatar
🤓
happy

FrannyZhao

🤓
happy
View GitHub Profile
@FrannyZhao
FrannyZhao / 0_reuse_code.js
Created May 24, 2016 06:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
git config --global alias.co checkout
git config --global alias.st status
git config --global alias.br branch
git config --global alias.f fetch
git config --global alias.cp cherry-pick
git config --global alias.rh 'reset --hard'
git config --global alias.l1 'log -1'
git config --global alias.rbm 'rebase origin/master'
/frameworks/base/core/res/res/drawable/pointer_arrow_icon.xml
./drawable-xxhdpi/pointer_arrow.png
./drawable-mdpi/pointer_arrow.png
./drawable-mdpi/pointer_arrow_large.png
./drawable-xhdpi/pointer_arrow.png
./drawable-xhdpi/pointer_arrow_large.png
./drawable/pointer_arrow_large_icon.xml
./drawable/pointer_arrow_icon.xml
./drawable-hdpi/pointer_arrow.png
private final UIHandler uiHandler = new UIHandler(this);
static class UIHandler extends Handler {
private final WeakReference<DashboardFragment> mFragment;
private static final int MSG_SHOW_MASK = 1;
private static final int MSG_HIDE_MASK = 2;
private UIHandler(DashboardFragment fragment) {
mFragment = new WeakReference<>(fragment);
}
Intent intent1= new Intent("android.intent.action.MAIN", null);
intent1.addCategory("android.intent.category.APP_GALLERY");
Intent intent2 = new Intent(Intent.ACTION_VIEW, Uri.parse("content://media/internal/images/media"));
// 两种办法都可以
mGallery.setOnClickListener(v -> startActivity(intent1));
zhaofengyi@moosgod-MS-7B10:~/mtkz300/system/core$ git diff
diff --git a/libcutils/fs_config.cpp b/libcutils/fs_config.cpp
index cc96ff8..8f44691 100644
--- a/libcutils/fs_config.cpp
+++ b/libcutils/fs_config.cpp
@@ -166,7 +166,7 @@ static const struct fs_path_config android_files[] = {
// the following two files are INTENTIONALLY set-uid, but they
// are NOT included on user builds.
{ 06755, AID_ROOT, AID_ROOT, 0, "system/xbin/procmem" },
- { 04750, AID_ROOT, AID_SHELL, 0, "system/xbin/su" },
$ cat src/com/franny/test/HelloWorld.java
package com.franny.test;
public class HelloWorld {
public native int doubleHelloWorld(int num); //申明一个native方法
static{
System.loadLibrary("HelloWorldImpl"); //装入动态链接库,"HelloWorldImpl"是装入动态链接库的名称
}
private static volatile TCPMessageHandler instance = null;
public static TCPMessageHandler getInstance() {
if (instance == null) {
synchronized (TCPMessageHandler.class) {
if (instance == null) {
instance = new TCPMessageHandler();
}
}
}
@FrannyZhao
FrannyZhao / ubuntu set alternative
Last active July 5, 2019 09:42
ubuntu set alternative
添加2个make版本:
$ sudo update-alternatives --install /usr/bin/make make /usr/bin/make3.81 1010
update-alternatives: using /usr/bin/make3.81 to provide /usr/bin/make (make) in auto mode
$ sudo update-alternatives --install /usr/bin/make make /usr/bin/make4.1 1011
update-alternatives: using /usr/bin/make4.1 to provide /usr/bin/make (make) in auto mode
查看一下是否添加成功:
$ sudo update-alternatives --display make
make - auto mode
@FrannyZhao
FrannyZhao / android开机启动adbd
Created September 4, 2019 07:44
android开机启动adbd方便调试
system/core/rootdir/init.rc中加上
on property:sys.boot_completed=1
write /sys/bus/platform/drivers/usb20_otg/force_usb_mode 2
start adbd