Skip to content

Instantly share code, notes, and snippets.

> adb shell pm list users
Users:
UserInfo{0:Owner:c13} running
UserInfo{12:configured_user:1010} running
@balachandarlinks
balachandarlinks / toolbarcolor
Created November 3, 2021 14:57 — forked from androidcodehunter/toolbarcolor
How to change toolbar back arrow color and title color?
From theme
<style name="SearchToolbar" parent="Theme.AppCompat.Light.NoActionBar">
//toolbar back arrow color
<item name="android:textColorSecondary">@android:color/white</item>
//toolbar title color
<item name="android:textColorPrimary">@android:color/white</item>
</style>
Also we can do it from java code:
> adb connect <ANDROID_TV_IP_ADDRESS>
> adb shell pm grant --user <USER_ID> in.codeseed.tvusage android.permission.SYSTEM_ALERT_WINDOW
@balachandarlinks
balachandarlinks / tvusage_grant_permissions.sh
Last active May 21, 2023 09:29
ADB Commands to grant permissions for TVUsage app.
> adb shell pm grant --user <USER_ID> in.codeseed.tvusage android.permission.PACKAGE_USAGE_STATS
> adb shell appops set --user <USER_ID> in.codeseed.tvusage GET_USAGE_STATS allow
> adb shell dumpsys deviceidle whitelist +in.codeseed.tvusage
@balachandarlinks
balachandarlinks / TestRunner.kt
Last active May 21, 2020 17:21
Disable animations for Android UI tests
import android.app.Application
import android.content.Context
import android.os.Bundle
import android.provider.Settings.Global.*
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.runner.AndroidJUnitRunner
class TestRunner : AndroidJUnitRunner() {
override fun onCreate(arguments: Bundle?) {
super.onCreate(arguments)
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@balachandarlinks
balachandarlinks / Dockerfile
Last active November 27, 2020 14:20
Dockerfile for https://github.com/gojuno/mainframer remote android build system.
FROM ubuntu:16.04
MAINTAINER Balachandar KM "balachandarlinks@gmail.com"
# Install java7
RUN apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository -y ppa:webupd8team/java && \
(echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections) && \
apt-get update && \
@balachandarlinks
balachandarlinks / mobile-AndroidManifest.xml
Created April 8, 2016 14:48 — forked from nschwermann/mobile-AndroidManifest.xml
Android Wearable Message API example
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="schwiz.net.weartest" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
@balachandarlinks
balachandarlinks / RecorderService.java
Created January 21, 2016 19:12 — forked from qihnus/RecorderService.java
a minimalist example of Android accessibility service
import android.accessibilityservice.AccessibilityService;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.util.Log;
import android.view.accessibility.AccessibilityEvent;
public class RecorderService extends AccessibilityService {
static final String TAG = "RecorderService";
private String getEventType(AccessibilityEvent event) {