Build "Sources for Android 28" so you can comfortably browse the Android API source in Android Studio.
- Collect source files
mkdir android-sdk-source-build
cd android-sdk-source-build
mkdir -p frameworks/base
// Copyright 2018 Google LLC. | |
// SPDX-License-Identifier: Apache-2.0 | |
const { google } = require("googleapis"); | |
const { Storage } = require("@google-cloud/storage"); | |
exports.csv2sheet = async (data, context) => { | |
var fileName = data.name; | |
// basic check that this is a *.csv file, etc... | |
if (!fileName.endsWith(".csv")) { |
Build "Sources for Android 28" so you can comfortably browse the Android API source in Android Studio.
mkdir android-sdk-source-build
cd android-sdk-source-build
mkdir -p frameworks/base
class DemoModeEnabler { | |
fun enable() { | |
executeShellCommand("settings put global sysui_demo_allowed 1") | |
sendCommand("exit") | |
sendCommand("enter") | |
sendCommand("notifications", "visible" to "false") | |
sendCommand("network", "wifi" to "hide") | |
sendCommand("battery", "level" to "100", "plugged" to "false") | |
sendCommand("clock", "hhmm" to "1000") |
/** | |
* Copyright (C) 2017 Drew Hannay | |
* <p> | |
* 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 | |
* <p> | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* <p> | |
* Unless required by applicable law or agreed to in writing, software |
public class InjectedInstrumentationTestRule implements MethodRule { | |
private final Object testModule; | |
public InjectedInstrumentationTestRule(Object testModule) { | |
this.testModule = testModule; | |
} | |
@Override | |
public Statement apply(final Statement statement, FrameworkMethod frameworkMethod, final Object testClassInstance) { |
#!/bin/sh | |
# Usage: ./watch-fds.sh <application_id> [delay_secs = 5] | |
APP_ID=${1:?missing application id} | |
DELAY=$(( ${2:-5} )) | |
DEVICE_LIMIT=$(( $(adb shell ulimit -n) )) | |
WARN_THRESHOLD=$(( ${DEVICE_LIMIT} / 3 )) | |
echo "Will warn at ${WARN_THRESHOLD}" |
package com.fewlaps.quitnow; | |
import android.content.ActivityNotFoundException; | |
import android.content.Context; | |
import android.content.Intent; | |
import android.net.Uri; | |
import java.util.ArrayList; | |
import java.util.List; |
package com.fewlaps.android.permissiongranter; | |
import android.app.Activity; | |
import android.content.pm.PackageManager; | |
import android.os.Build; | |
import android.support.test.uiautomator.UiDevice; | |
import android.support.test.uiautomator.UiObject; | |
import android.support.test.uiautomator.UiObjectNotFoundException; | |
import android.support.test.uiautomator.UiSelector; | |
import android.support.v4.content.ContextCompat; |
¯\_(ツ)_/¯
public static Action1<Throwable> crashOnError() { | |
final Throwable checkpoint = new Throwable(); | |
return throwable -> { | |
StackTraceElement[] stackTrace = checkpoint.getStackTrace(); | |
StackTraceElement element = stackTrace[1]; // First element after `crashOnError()` | |
String msg = String.format("onError() crash from subscribe() in %s.%s(%s:%s)", | |
element.getClassName(), | |
element.getMethodName(), | |
element.getFileName(), | |
element.getLineNumber()); |