<p dir="auto">I need to put my application in background (and not close it) when users click back.<br>
Currently we use something like:</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@Override
public void onBackPressed() {
    moveTaskToBack(true);
}"><pre class="notranslate"><span class="pl-c1">@</span><span class="pl-c1">Override</span>
<span class="pl-k">public</span> <span class="pl-smi">void</span> <span class="pl-s1">onBackPressed</span>() {
    <span class="pl-en">moveTaskToBack</span>(<span class="pl-c1">true</span>);
}</pre></div>
<p dir="auto">The problem is by doing so the back event into the flutter app is broken.<br>
FlutterActivity already override this method to manage the back event.</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=" public void onBackPressed() {
        if (!this.eventDelegate.onBackPressed()) {
            super.onBackPressed();
        }
    }"><pre class="notranslate"> <span class="pl-k">public</span> <span class="pl-smi">void</span> <span class="pl-s1">onBackPressed</span>() {
        <span class="pl-k">if</span> (!<span class="pl-smi">this</span>.<span class="pl-s1">eventDelegate</span>.<span class="pl-en">onBackPressed</span>()) {
            <span class="pl-en">super</span>.<span class="pl-en">onBackPressed</span>();
        }
    }</pre></div>
<p dir="auto">So I would like to do:</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="@Override
public void onBackPressed() {
      if (!this.eventDelegate.onBackPressed()) {
            moveTaskToBack(true);
        }
}"><pre class="notranslate"><span class="pl-c1">@</span><span class="pl-c1">Override</span>
<span class="pl-k">public</span> <span class="pl-smi">void</span> <span class="pl-s1">onBackPressed</span>() {
      <span class="pl-k">if</span> (!<span class="pl-smi">this</span>.<span class="pl-s1">eventDelegate</span>.<span class="pl-en">onBackPressed</span>()) {
            <span class="pl-en">moveTaskToBack</span>(<span class="pl-c1">true</span>);
        }
}</pre></div>
<p dir="auto">but not possible as <code class="notranslate">this.eventDelegate</code> is only private. I have no way of doing this for now except copy/paste the <code class="notranslate">FlutterActivity</code> code.</p>
<p dir="auto">I'm trying to "stress test" the rendering performance of a little "painted" animation. When I display only  a single instance of this animation, everything is fine,</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/1397248/33068395-6fef154a-ceb1-11e7-9231-3ae0fea31a22.png"><img src="https://user-images.githubusercontent.com/1397248/33068395-6fef154a-ceb1-11e7-9231-3ae0fea31a22.png" alt="www_rxlabz_com_labz_glitches_mov" style="max-width: 100%;"></a></p>
<p dir="auto">but if I duplicate it, some visual glitches appear.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/1397248/33068352-408c5b5a-ceb1-11e7-93b7-29ced84f5e85.png"><img src="https://user-images.githubusercontent.com/1397248/33068352-408c5b5a-ceb1-11e7-93b7-29ced84f5e85.png" alt="www_rxlabz_com_labz_glitches_mov" style="max-width: 100%;"></a></p>
<p dir="auto">Here's a record showing the problem : <a href="http://www.rxlabz.com/labz/glitches.mov" rel="nofollow">http://www.rxlabz.com/labz/glitches.mov</a></p>
<p dir="auto">Most of the time the glitch appears at the end of animation during the check mark drawing, but it changes sometimes</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/1397248/33068762-93177db8-ceb2-11e7-9006-4ab729ad7635.png"><img src="https://user-images.githubusercontent.com/1397248/33068762-93177db8-ceb2-11e7-9006-4ab729ad7635.png" alt="boite_de_reception__2 669 messages__814_non_lus_" style="max-width: 100%;"></a></p>
<p dir="auto">video2 : <a href="http://www.rxlabz.com/labz/glitches_2.mov" rel="nofollow">http://www.rxlabz.com/labz/glitches_2.mov</a></p>
<p dir="auto">Some more informations :</p>
<ul dir="auto">
<li>Everything is drawn with a drawPath instruction</li>
<li>I use a stateful widget which uses an animation controller to know when to send the new drawing commands to it's CustomPaint child</li>
<li>this problem appears in release mode, on iOS and android</li>
<li>sometimes, after few seconds everything is back to normal on each instance, sometimes not.</li>
</ul>
<p dir="auto">Any idea on how I can try to prevent/avoid this ?</p>
<h2 dir="auto">Flutter Doctor</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[✓] Flutter (on Mac OS X 10.12.6 16G1036, locale fr-FR, channel master)
    • Flutter at /Users/rxlabz/dev/tools/flutter
    • Framework revision 928d2cc764 (3 days ago), 2017-11-17 15:45:27 -0800
    • Engine revision 4733e33737
    • Tools Dart version 1.25.0-dev.11.0

[✓] Android toolchain - develop for Android devices (Android SDK 25.0.3)
    • Android SDK at /Users/rxlabz/Library/Android/sdk
    • Platform android-25, build-tools 25.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] iOS toolchain - develop for iOS devices (Xcode 9.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.0, Build version 9A235
    • ios-deploy 1.9.2
    • CocoaPods version 1.2.0

[✓] Android Studio (version 2.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] IntelliJ IDEA Ultimate Edition (version 2017.2.3 EAP)
    • Flutter plugin version 19.1
    • Dart plugin version 172.3317.48

[✓] Connected devices
    • A3 A40   • 622004271815                             • android-arm • Android 6.0 (API 23)
    • iPhone 8 • 3550BDC4-7E32-43DB-BBB3-3A8B4D7254D9     • ios         • iOS 11.0 (simulator)"><pre class="notranslate"><code class="notranslate">[✓] Flutter (on Mac OS X 10.12.6 16G1036, locale fr-FR, channel master)
    • Flutter at /Users/rxlabz/dev/tools/flutter
    • Framework revision 928d2cc764 (3 days ago), 2017-11-17 15:45:27 -0800
    • Engine revision 4733e33737
    • Tools Dart version 1.25.0-dev.11.0

[✓] Android toolchain - develop for Android devices (Android SDK 25.0.3)
    • Android SDK at /Users/rxlabz/Library/Android/sdk
    • Platform android-25, build-tools 25.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] iOS toolchain - develop for iOS devices (Xcode 9.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 9.0, Build version 9A235
    • ios-deploy 1.9.2
    • CocoaPods version 1.2.0

[✓] Android Studio (version 2.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)

[✓] IntelliJ IDEA Ultimate Edition (version 2017.2.3 EAP)
    • Flutter plugin version 19.1
    • Dart plugin version 172.3317.48

[✓] Connected devices
    • A3 A40   • 622004271815                             • android-arm • Android 6.0 (API 23)
    • iPhone 8 • 3550BDC4-7E32-43DB-BBB3-3A8B4D7254D9     • ios         • iOS 11.0 (simulator)
</code></pre></div>