All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.robolectric.shadows.ShadowDebug Maven / Gradle / Ivy

The newest version!
package org.robolectric.shadows;

import android.os.Debug;

import com.google.common.collect.ImmutableMap;

import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;

import java.util.Map;

import static android.os.Build.VERSION_CODES;
import static android.os.Build.VERSION_CODES.M;

@Implements(Debug.class)
public class ShadowDebug {
  @Implementation
  public static void __staticInitializer__() {
    // Avoid calling Environment.getLegacyExternalStorageDirectory()
  }

  @Implementation
  public static long getNativeHeapAllocatedSize() {
    return Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
  }

  @Implementation(minSdk = M)
  public static Map getRuntimeStats() {
    return ImmutableMap.builder().build();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy