From c083d900ca3f25a809c7b35fda1bed0e6d13b884 Mon Sep 17 00:00:00 2001 From: William Wu Date: Fri, 4 Jun 2021 16:17:26 +0800 Subject: [PATCH] OMagnifier first update --- .idea/.gitignore | 3 + .idea/.name | 1 + .idea/compiler.xml | 6 + .idea/jarRepositories.xml | 25 +++ .idea/misc.xml | 9 + .idea/runConfigurations.xml | 10 + CONTRIBUTING.md | 65 +++++++ README.md | 129 +++++++++++-- SECURITY.md | 10 +- app/.gitignore | 1 + app/build.gradle | 51 +++++ app/proguard-rules.pro | 21 +++ .../magnifier/ExampleInstrumentedTest.kt | 29 +++ app/src/main/AndroidManifest.xml | 25 +++ .../office/outlook/magnifier/MainActivity.kt | 133 +++++++++++++ .../drawable-v24/ic_launcher_foreground.xml | 34 ++++ .../res/drawable/ic_launcher_background.xml | 174 ++++++++++++++++++ app/src/main/res/layout/activity_main.xml | 81 ++++++++ .../res/mipmap-anydpi-v26/ic_launcher.xml | 9 + .../mipmap-anydpi-v26/ic_launcher_round.xml | 9 + app/src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 3593 bytes .../res/mipmap-hdpi/ic_launcher_round.png | Bin 0 -> 5339 bytes app/src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2636 bytes .../res/mipmap-mdpi/ic_launcher_round.png | Bin 0 -> 3388 bytes app/src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4926 bytes .../res/mipmap-xhdpi/ic_launcher_round.png | Bin 0 -> 7472 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 7909 bytes .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin 0 -> 11873 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 10652 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin 0 -> 16570 bytes app/src/main/res/values-night/themes.xml | 20 ++ app/src/main/res/values/colors.xml | 14 ++ app/src/main/res/values/strings.xml | 7 + app/src/main/res/values/themes.xml | 20 ++ .../outlook/magnifier/ExampleUnitTest.kt | 22 +++ build.gradle | 30 +++ gradle.properties | 21 +++ gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 54329 bytes gradle/wrapper/gradle-wrapper.properties | 6 + gradlew | 172 +++++++++++++++++ gradlew.bat | 84 +++++++++ magnifierlib/.gitignore | 1 + magnifierlib/build.gradle | 51 +++++ magnifierlib/consumer-rules.pro | 0 magnifierlib/gradle.properties | 3 + magnifierlib/proguard-rules.pro | 21 +++ magnifierlib/publish.gradle | 88 +++++++++ .../magnifierlib/ExampleInstrumentedTest.kt | 28 +++ magnifierlib/src/main/AndroidManifest.xml | 12 ++ .../office/outlook/magnifierlib/Magnifier.kt | 49 +++++ .../outlook/magnifierlib/Permissions.kt | 24 +++ .../outlook/magnifierlib/frame/FPSMonitor.kt | 57 ++++++ .../magnifierlib/frame/FPSMonitorConfig.kt | 45 +++++ .../magnifierlib/frame/FrameCalculator.kt | 61 ++++++ .../outlook/magnifierlib/frame/FrameViewer.kt | 118 ++++++++++++ .../memory/FileDescriptorMetricCollector.kt | 18 ++ .../memory/HeapMetricCollector.kt | 34 ++++ .../magnifierlib/memory/MemoryMonitor.kt | 109 +++++++++++ .../memory/MemoryMonitorConfig.kt | 69 +++++++ .../magnifierlib/memory/MemorySampler.kt | 46 +++++ .../memory/MemorySamplersFactory.kt | 115 ++++++++++++ .../magnifierlib/memory/MemoryUtils.kt | 73 ++++++++ .../magnifierlib/memory/SamplePolicy.kt | 51 +++++ .../memory/ThreadMetricCollector.kt | 19 ++ .../src/main/res/drawable/fps_bad.xml | 11 ++ .../src/main/res/drawable/fps_good.xml | 11 ++ .../src/main/res/drawable/fps_medium.xml | 11 ++ .../src/main/res/layout/frame_view.xml | 15 ++ magnifierlib/src/main/res/values/dimens.xml | 8 + .../outlook/magnifierlib/ExampleUnitTest.kt | 21 +++ settings.gradle | 3 + 71 files changed, 2373 insertions(+), 20 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/.name create mode 100644 .idea/compiler.xml create mode 100644 .idea/jarRepositories.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/runConfigurations.xml create mode 100644 CONTRIBUTING.md create mode 100644 app/.gitignore create mode 100644 app/build.gradle create mode 100644 app/proguard-rules.pro create mode 100644 app/src/androidTest/java/com/microsoft/office/outlook/magnifier/ExampleInstrumentedTest.kt create mode 100644 app/src/main/AndroidManifest.xml create mode 100644 app/src/main/java/com/microsoft/office/outlook/magnifier/MainActivity.kt create mode 100644 app/src/main/res/drawable-v24/ic_launcher_foreground.xml create mode 100644 app/src/main/res/drawable/ic_launcher_background.xml create mode 100644 app/src/main/res/layout/activity_main.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png create mode 100644 app/src/main/res/values-night/themes.xml create mode 100644 app/src/main/res/values/colors.xml create mode 100644 app/src/main/res/values/strings.xml create mode 100644 app/src/main/res/values/themes.xml create mode 100644 app/src/test/java/com/microsoft/office/outlook/magnifier/ExampleUnitTest.kt create mode 100644 build.gradle create mode 100644 gradle.properties create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100755 gradlew create mode 100644 gradlew.bat create mode 100644 magnifierlib/.gitignore create mode 100644 magnifierlib/build.gradle create mode 100644 magnifierlib/consumer-rules.pro create mode 100644 magnifierlib/gradle.properties create mode 100644 magnifierlib/proguard-rules.pro create mode 100644 magnifierlib/publish.gradle create mode 100644 magnifierlib/src/androidTest/java/com/microsoft/office/outlook/magnifierlib/ExampleInstrumentedTest.kt create mode 100644 magnifierlib/src/main/AndroidManifest.xml create mode 100644 magnifierlib/src/main/java/com/microsoft/office/outlook/magnifierlib/Magnifier.kt create mode 100644 magnifierlib/src/main/java/com/microsoft/office/outlook/magnifierlib/Permissions.kt create mode 100644 magnifierlib/src/main/java/com/microsoft/office/outlook/magnifierlib/frame/FPSMonitor.kt create mode 100644 magnifierlib/src/main/java/com/microsoft/office/outlook/magnifierlib/frame/FPSMonitorConfig.kt create mode 100644 magnifierlib/src/main/java/com/microsoft/office/outlook/magnifierlib/frame/FrameCalculator.kt create mode 100644 magnifierlib/src/main/java/com/microsoft/office/outlook/magnifierlib/frame/FrameViewer.kt create mode 100644 magnifierlib/src/main/java/com/microsoft/office/outlook/magnifierlib/memory/FileDescriptorMetricCollector.kt create mode 100644 magnifierlib/src/main/java/com/microsoft/office/outlook/magnifierlib/memory/HeapMetricCollector.kt create mode 100644 magnifierlib/src/main/java/com/microsoft/office/outlook/magnifierlib/memory/MemoryMonitor.kt create mode 100644 magnifierlib/src/main/java/com/microsoft/office/outlook/magnifierlib/memory/MemoryMonitorConfig.kt create mode 100644 magnifierlib/src/main/java/com/microsoft/office/outlook/magnifierlib/memory/MemorySampler.kt create mode 100644 magnifierlib/src/main/java/com/microsoft/office/outlook/magnifierlib/memory/MemorySamplersFactory.kt create mode 100644 magnifierlib/src/main/java/com/microsoft/office/outlook/magnifierlib/memory/MemoryUtils.kt create mode 100644 magnifierlib/src/main/java/com/microsoft/office/outlook/magnifierlib/memory/SamplePolicy.kt create mode 100644 magnifierlib/src/main/java/com/microsoft/office/outlook/magnifierlib/memory/ThreadMetricCollector.kt create mode 100644 magnifierlib/src/main/res/drawable/fps_bad.xml create mode 100644 magnifierlib/src/main/res/drawable/fps_good.xml create mode 100644 magnifierlib/src/main/res/drawable/fps_medium.xml create mode 100644 magnifierlib/src/main/res/layout/frame_view.xml create mode 100644 magnifierlib/src/main/res/values/dimens.xml create mode 100644 magnifierlib/src/test/java/com/microsoft/office/outlook/magnifierlib/ExampleUnitTest.kt create mode 100644 settings.gradle diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..728e6bc --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +magnifier \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..fb7f4a8 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..a5f05cd --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..860da66 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..797acea --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..7d41f00 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,65 @@ +# Contribution Guidelines + +Thank you for your interest in Verifiable Credentials! + +This project welcomes contributions and suggestions. Most contributions require you to +agree to a Contributor License Agreement (CLA) declaring that you have the right to, +and actually do, grant us the rights to use your contribution. + +For details, visit https://cla.microsoft.com. + +When you submit a pull request, a CLA-bot will automatically determine whether you need +to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the +instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the Microsoft Open Source Code of Conduct. +For more information see the Code of Conduct FAQ +or contact opencode@microsoft.com with any additional questions or comments. + +Contributions come in many forms: submitting issues, writing code, participating in discussions and community calls. + +This document provides the guidelines for how to contribute to the Verifiable Credentials Wallet SDK project. + +## Issues + +This section describes the guidelines for submitting issues + +### Issue Types + +There are 4 types of issues: + +- Issue/Bug: You've found a bug with the code, and want to report it, or create an issue to track the bug. +- Issue/Discussion: You have something on your mind, which requires input form others in a discussion, before it eventually manifests as a proposal. +- Issue/Proposal: Used for items that propose a new idea or functionality. This allows feedback from others before code is written. +- Issue/Question: Use this issue type, if you need help or have a question. + +## Contributing + +This section describes the guidelines for contributing code / docs to the project. + +### Pull Requests + +All contributions come through pull requests. To submit a proposed change, we recommend following this workflow: + +1. Make sure there's an issue (bug or proposal) raised, which sets the expectations for the contribution you are about to make. +2. Fork the relevant repo and create a new branch +3. Create your change + - Code changes require tests +4. Update relevant documentation for the change +5. Commit and open a PR +6. Wait for the CI process to finish and make sure all checks are green +7. A maintainer of the project will be assigned, and you can expect a review within a few days + +#### Use work-in-progress PRs for early feedback + +A good way to communicate before investing too much time is to create a "Work-in-progress" PR and share it with your reviewers. The standard way of doing this is to add a "[WIP]" prefix in your PR's title and assign the **do-not-merge** label. This will let people looking at your PR know that it is not well baked yet. + +### Use of Third-party code + +- Third-party code must include licenses. + +**Thank You!** - Your contributions to open source, large or small, make projects like this possible. Thank you for taking the time to contribute. + +## Code of Conduct + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). \ No newline at end of file diff --git a/README.md b/README.md index 5cd7cec..cfe6007 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,119 @@ -# Project +# OMagnifier -> This repo has been populated by an initial template to help get you started. Please -> make sure to update the content to build a great experience for community-building. +OMagnifier is an Android APM SDK that can be used to monitor the app performance. + +## Features Support +- [x] Frame rate monitor: floating window for showing fps +- [x] Memory usage metrics monitor: monitor and collect the memeory usage metrics +- [ ] Memory usage viewer +- [ ] Battery usage monitor + +## APIs +### Frame rate monitor + +1. Start frame rate monitor +```kotlin +Magnifier.startMonitorFPS( + FPSMonitorConfig.Builder(this.application) + .lowPercentage(40 / 60f) // show red tips, (2.0f / 3.0f) by default + .mediumPercentage(50 / 60f) // show yellow tips, (5.0f / 6.0f) by default + .refreshRate(60f) // defaultDisplay.refreshRate by default + .build() +) +``` + +2. Stop frame rate monitor +```kotlin +Magnifier.stopMonitorFPS() +``` + +### Memory usage monitor + +The mectrics we support now: + +- `HeapMemoryInfo`: heap memory and vss/pss memory +- `FileDescriptorInfo`: file readlink and max open file count +- `ThreadInfo`: thread count and thread stack trace + +1. Start Memory usage metrics monitor + +```kotlin +MemoryMonitorConfig.Builder() + .enableExceedLimitSample(0.8f, // the benchmark for Exceed_Limit type sampler, if we reach out 80% the max, collect the metrics, 0.8f by default + 10000 // the threshold for Exceed_Limit type sampler, 10s by default + ) + .enableTimingSample(60 * 1000) // threshold for the timing checker, 1 min by default + .onSampleListener(object : MemoryMonitor.OnSampleListener { + override fun onSampleHeap( + heapMemoryInfo: HeapMemoryInfo, + sampleType: MemoryMonitor.SampleType + ) { + Log.d(TAG, "heapMemoryInfo:$heapMemoryInfo,sampleType:$sampleType") + } + + override fun onSampleFile( + fileDescriptorInfo: FileDescriptorInfo, + sampleType: MemoryMonitor.SampleType + ) { + Log.d(TAG, "fileDescriptorInfo:${fileDescriptorInfo.fdMaxCount},sampleType:$sampleType") + } + + override fun onSampleThread( + threadInfo: ThreadInfo, + sampleType: MemoryMonitor.SampleType + ) { + Log.d(TAG, "threadInfo:${threadInfo.threadsCount},sampleType:$sampleType") + } + }).build() +``` + +2. Collect the memory usage metrics immdiately + +```koltin +Magnifier.dumpMemoryImmediately(object : MemoryMonitor.OnSampleListener { + override fun onSampleHeap( + heapMemoryInfo: HeapMemoryInfo, + sampleType: MemoryMonitor.SampleType + ) { + Log.d(TAG, "heapMemoryInfo:$heapMemoryInfo,sampleType:$sampleType") + } + + override fun onSampleFile( + fileDescriptorInfo: FileDescriptorInfo, + sampleType: MemoryMonitor.SampleType + ) { + Log.d(TAG, "fileDescriptorInfo:${fileDescriptorInfo.fdMaxCount},sampleType:$sampleType") + } + + override fun onSampleThread( + threadInfo: ThreadInfo, + sampleType: MemoryMonitor.SampleType + ) { + Log.d(TAG, "threadInfo:${threadInfo.threadsCount},sampleType:$sampleType") + } +}) +``` + + +3. Stop frame rate monitor + +```kotlin +Magnifier.stopMonitorMemory() +``` + +## Demo + +The demo is under Module app. + +1. Install the app +2. Run the app +3. Click the button for testing -As the maintainer of this project, please make a few updates: -- Improving this README.MD file to provide a great experience -- Updating SUPPORT.MD with content about this project's support experience -- Understanding the security reporting process in SECURITY.MD -- Remove this section from the README ## Contributing -This project welcomes contributions and suggestions. Most contributions require you to agree to a +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com. @@ -24,10 +125,8 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. -## Trademarks +## License -This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft -trademarks or logos is subject to and must follow -[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). -Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. -Any use of third-party trademarks or logos are subject to those third-party's policies. +Copyright (c) Microsoft Corporation. All rights reserved. + +Licensed under the [MIT](LICENSE) license. \ No newline at end of file diff --git a/SECURITY.md b/SECURITY.md index f7b8998..e0dfff5 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,10 +1,10 @@ - + ## Security Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). -If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)), please report it to us as described below. +If you believe you have found a security vulnerability in any Microsoft-owned repository that meets Microsoft's [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383(v=technet.10)) of a security vulnerability, please report it to us as described below. ## Reporting Security Issues @@ -12,9 +12,9 @@ If you believe you have found a security vulnerability in any Microsoft-owned re Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://msrc.microsoft.com/create-report). -If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc). +If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the the [Microsoft Security Response Center PGP Key page](https://www.microsoft.com/en-us/msrc/pgp-key-msrc). -You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). +You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://www.microsoft.com/msrc). Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: @@ -38,4 +38,4 @@ We prefer all communications to be in English. Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://www.microsoft.com/en-us/msrc/cvd). - \ No newline at end of file + diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..6adf66d --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,51 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + */ + +plugins { + id 'com.android.application' + id 'kotlin-android' +} + +android { + compileSdkVersion 30 + buildToolsVersion "30.0.3" + + defaultConfig { + applicationId "com.microsoft.office.outlook.magnifier" + minSdkVersion 16 + targetSdkVersion 30 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' + } +} + +dependencies { + + implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation 'androidx.core:core-ktx:1.3.2' + implementation 'androidx.appcompat:appcompat:1.2.0' + implementation 'com.google.android.material:material:1.3.0' + implementation 'androidx.constraintlayout:constraintlayout:2.0.4' + testImplementation 'junit:junit:4.+' + androidTestImplementation 'androidx.test.ext:junit:1.1.2' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' + implementation project(':magnifierlib') +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/src/androidTest/java/com/microsoft/office/outlook/magnifier/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/microsoft/office/outlook/magnifier/ExampleInstrumentedTest.kt new file mode 100644 index 0000000..39d0ece --- /dev/null +++ b/app/src/androidTest/java/com/microsoft/office/outlook/magnifier/ExampleInstrumentedTest.kt @@ -0,0 +1,29 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + */ + +package com.microsoft.office.outlook.magnifier + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 + +import org.junit.Test +import org.junit.runner.RunWith + +import org.junit.Assert.* + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.microsoft.office.outlook.magnifier", appContext.packageName) + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..ea03564 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/microsoft/office/outlook/magnifier/MainActivity.kt b/app/src/main/java/com/microsoft/office/outlook/magnifier/MainActivity.kt new file mode 100644 index 0000000..394710c --- /dev/null +++ b/app/src/main/java/com/microsoft/office/outlook/magnifier/MainActivity.kt @@ -0,0 +1,133 @@ +/* + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + */ + +package com.microsoft.office.outlook.magnifier + +import android.app.Activity +import android.os.Bundle +import android.util.Log +import android.widget.Button +import com.microsoft.office.outlook.magnifierlib.Magnifier +import com.microsoft.office.outlook.magnifierlib.frame.FPSMonitorConfig +import com.microsoft.office.outlook.magnifierlib.memory.FileDescriptorInfo +import com.microsoft.office.outlook.magnifierlib.memory.HeapMemoryInfo +import com.microsoft.office.outlook.magnifierlib.memory.MemoryMonitor +import com.microsoft.office.outlook.magnifierlib.memory.MemoryMonitorConfig +import com.microsoft.office.outlook.magnifierlib.memory.ThreadInfo + +class MainActivity : Activity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_main) + + val buttonStartFPS = findViewById